Telerik Forums
UI for ASP.NET MVC Forum
1 answer
261 views

Good Afternoon,

Not sure why this is happening but hope somebody can help.

I need to add tabs dynamically which works ok but once they are added I can see it's content in the tabs that already existed. It's definitely the new tab's content as when I change the options in one tab, the changes are reflected in the other tabs. My code is below and I have attached some screenshots also. I would be really grateful for any assistance.

<button type="button" class="btn btn-success" id="myButton">Add New Job</button>

 <p></p>     
@(Html.Kendo().TabStrip()
              .Name("tabstrip")              
              .Items(tabstrip =>
              {
                  tabstrip.Add().Text("1: BAIC13 ")
                      .Selected(true)
                      .LoadContentFrom(Url.Action("Job1", "Test"));
                  tabstrip.Add().Text("OPERATORS")
                      .LoadContentFrom(Url.Action("Operators", "Test"));
              })             
)
    </div>

<script>
 
    $(document).ready(function () {
        $("#myButton").click(function () {
            var tabStrip = $("#tabstrip").kendoTabStrip().data("kendoTabStrip");
            var lastIndex = tabStrip.tabGroup.children("li:last").index();
            tabStrip.insertBefore(
                    {
                        text: "New Tab",
                        contentUrl: '@Url.Action("AddJob", "Test")'          
                    },
                    tabStrip.tabGroup.children("li:last")
            );
            tabStrip.select(lastIndex);
        });
    });    
</script>

 

 

 

Dimitar
Telerik team
 answered on 11 Jul 2016
5 answers
890 views

I have a kendo grid with Multiple column sorting enabled. The issue is whenever sorting is enabled, user can right click on column and click on 'Open link in new tab', and when clicked, user gets directed to error page e.g. the new page would look like: http://localhost:50411/PurchaseOrder/GetPurchaseOrders?GridPOSearchHeaderInfo-sort=Revision-asc (this page doesn't exists)
I checked Kendo grid sorting demo page: http://demos.telerik.com/kendo-ui/grid/sorting and tried opening link in new tab by right clicking the column in the grid and it doesn't have tis issue. The new page url is: http://demos.telerik.com/kendo-ui/grid/sorting# so it would pretty much load same page. 

Is there anyway to disable right click on the kendo grid's column or not generate that random page?

Here is my razor code:

@(Html.Kendo().Grid<SupplierPortal.ViewModels.PaymentResultViewModel>()
    .Name("GridPaymentSearchHeaderInfo")
    .Columns(columns =>
    {
        columns.Bound(e => e.PaymentNumber).Width("160px").HtmlAttributes(new { @style = "text-align:right;" });
        columns.Bound(e => e.PaidToName).Width("170px");                   
    })                 
    .ToolBar(tools =>
    {
    tools.Template(@<text>
    <div class="pull-right" style="display: inline-block; padding-right: 10px; padding-top: 2px; padding-bottom: 2px;">
        <a href="#" class="k-button updateView" title="Update Selected View"><i class="fa fa-floppy-o" aria-hidden="true"></i></a>
        <a href="#" class="k-button addView" title="Add New View"><i class="fa fa-plus" aria-hidden="true"></i></a>
        <a href="#" class="k-button deleteView" title="Delete Selected View"><i class="fa fa-times" aria-hidden="true"></i></a>
        <span class="preline"></span>
        <a class="k-button k-button-icontext k-grid-excel POexport" href="#" title="Export to Excel" style="background: #f8fdae;"><span class="k-icon k-i-excel"></span></a>
    </div>
    <div class="col-lg-4 col-md-5 col-sm-5 col-xs-7 pull-right" style="padding-right: 0;">
        <div class="form-group" style="margin-bottom: 0;">
            @Html.Label("Grid View:", new { @class = "col-sm-3 col-xs-4 control-label view" })
            <div class="col-sm-7 col-xs-6" style="padding-left: 0;">
                @Html.DropDownList("lstViewNamesGridPaymentSearchHeaderInfo", new SelectList(Model.ViewNames, "Value", "Text", Model.SelectedPaymentViewId), "All Columns", new { @class = "form-control lstViewNames", @style = "height: auto;" })
            </div>
        </div>
    </div>
    </text>);
    })
    .ColumnMenu()
    .Pageable(x => x.PageSizes(new object[] { 10, 20, 50, 100, "All" }))
    .Reorderable(reorder => reorder.Columns(true))
    .AutoBind(false)
    .Reorderable(reorder => reorder.Columns(true))
    .Selectable()
    .Filterable(filterable => filterable
                    .Extra(false)
                    .Operators(operators => operators
                        .ForString(str => str.Clear()
                            .Contains("Contains")
                            .StartsWith("Starts with")
                            .IsEqualTo("Is equal to")
                            .IsNotEqualTo("Is not equal to")
                        ))
                    )
    .Sortable(sortable => sortable
        .AllowUnsort(true)
        .SortMode(GridSortMode.MultipleColumn))
    .Scrollable(scr => scr.Height(322))
    .Resizable(resize => resize.Columns(true))
    .DataSource(dataSource => dataSource
                .Ajax()
                .PageSize(10)
                .ServerOperation(false)
                .Read(read => read.Action("GetPayments", "Payment").Data("GetSearchParameters"))
                )
    .Events(events => events.Change("changeHeaderInfo"))
    .Events(events => events.DataBound("gridDataBound"))
    .Events(events => events.DataBinding("gridDataBinding"))
    .Events(events => events.ColumnMenuInit("gridColumnMenuInit"))
)

Vessy
Telerik team
 answered on 11 Jul 2016
3 answers
182 views

Hello,

there is bug in ToDataSourceResult method, namely internal FirstSortableProperty method. The FirstSortableProperty method is called when passed DataSourceRequest has no Sorts list. It uses reflection to select first property of queryable entity.

If your entity class has a "calculated" readonly property that is not mapped to the database entity, the FirstSortableProperty method might select it so the LINQ query fails. It supposed to select public instance properties with getters and setters only.

Thanks.
Vasil
Telerik team
 answered on 08 Jul 2016
10 answers
3.5K+ views

I want to present a data element as a tool tip in a grid that has limited space. The data would be a property of the object the grid already displays. This particular property is not displayed due to limited space. I've looked through all the examples I can find. None of them look like what I'm trying to accomplish.

Ideally the user would hover over a row or a cell on a given row and the tooltip would be displayed. In this case the data would indicate whether or not a warehouse item had been picked up or not.

If this is possible, do you have an example in Razor format? This will be implemented in a .cshtml view in MVC4.

Thanks for your help with this!

Viktor Tachev
Telerik team
 answered on 08 Jul 2016
4 answers
181 views

Hi guys, basically i have mvc kendo ui application. where i have two kendo ui datetimepicker wrappers. What i want to do is on pageload of the grid i would like to flag boolean variable with "true". if true value means its on pageload. So based on the true value i do something like this on the date filters below...

public JsonResult GetIncidents([DataSourceRequest]DataSourceRequest request, int? AccountID, int? SiteID, int? StatusID, int? AuditID, DateTime DateFrom, DateTime EndDate, bool isPageLoaded)
      {
          
          
           
 
          using (var db = new IntelligentThinkingACSAEntities())
          {
              DateTime startDate = DateTime.Now;
              if (isPageLoaded)
              {
                  startDate = DateFrom.AddDays(-10);
                   
                
                  //  DateTime endDate = DateTo.AddDays(-10);
              }
              else
              {
                  startDate = DateFrom;
              }

if its not pageload it will not filter data based on the ten days back date

im passing parametes like these below...

function IncidentsFilter() {
         
 
         return {
             AccountID: $("#KAirports").val() === "" ? 0 : $("#KAirports").val(),
             SiteID: $("#KSite").val() === "" ? 0 : $("#KSite").val(),
             StatusID: $("#KStatusFilter").val() === "" ? 0 : $("#KStatusFilter").val(),
             AuditID:  $("#KAuditS").val() === "" ? 0 : $("#KAuditS").val(),
             DateFrom: $("#KDateFrom").val() === "" ? new Date : $("#KDateFrom").val(),
             EndDate: $("#KDateTo").val() === "" ? new Date : $("#KDateTo").val(),
             isPageLoaded: true
            
 
             
         };
     }

 

Please help guys, Im stuck

Marc Plaxton-Harrison
Top achievements
Rank 1
 answered on 08 Jul 2016
1 answer
154 views

I would like to provide drag and drop between a Grid and a Listview (a message is dragged from

the grid of messages into a folder in a listview).

Is this possible with Telerik ASP.NET MVC ? Or do I need to do it with Javascript?

 

Eyup
Telerik team
 answered on 08 Jul 2016
1 answer
852 views

I have an MVC Grid with Popup edit mode for adding records. Once popup is opened and Update is pressed - I want to save the record and prevent popup window from being automatically closed. After that in popup window when I select some different values and press Update again - I want a new row to be added.

I was able to prevent Popup from being auto-closed and on Update press current record is saved and a new one is created but it isn't reflected in the underlying table. On first picture Update button is pressed (update_clicked.jpg). On second picture I've changed the file name to "test2" and pressed Update again thus creating a new record with "File" set to "test2". The problem is that this isn't reflected in the underlying table - there's only one row there. After I refreshed the page (last picture) - it shows both rows and this is how it should be.

I think I need to refresh the dataSource to update the underlying table markup but if I call $("#gridBreakDowns").data("kendoGrid").dataSource.read() - Popup window is closed and table is refreshed but I want is to prevent the Popup being closed with the table refreshed instead.

This is done to add records more quickly while preserving the values in other fields since they're repeated most of the time.

 

This is what I've got:

 

@(Html.Kendo().Grid(Model.ManualJobItems)
 .Name("gridBreakDowns")
 .ToolBar(toolbar => toolbar.Create().Text("Create"))
 .Columns(columns =>
 {
 columns.Bound(p => p.ItemID).Hidden(true);
 columns.Bound(p => p.ParentID).Hidden(true);
 columns.Bound(p => p.Country).Title("Country");
 columns.Bound(p => p.FileName).Title("File");
 columns.Bound(p => p.Format).Title("Format");
 columns.Bound(p => p.Quantity).Title("Quantity");
 columns.Bound(p => p.Service).Title("Service");
 columns.Bound(p => p.Method).Title("Service Level");
 columns.Bound(p => p.ItemWeight).Title("Item Weight");
 columns.Bound(p => p.TotalWeight).Title("Total Weight");
 columns.Bound(p => p.DespatchStatusString).Title("Status");
 columns.Command(c => { c.Destroy(); }).Width(100);
 })
 .Events(events => events.Edit("onGridEdit").Save("onGridSave"))
 .Editable(editable => editable
 .Mode(GridEditMode.PopUp)
 .TemplateName("CreateManualJobItem")
 .AdditionalViewData(new { Model.ClientCode }))
 .DataSource(dataSource => dataSource
 .Ajax()
 .Events(events => events.Error("onerror_handler"))
 .Create(create => create.Action("UpdateItem", "ManualJob"))
 .Read(read => read.Action("ReadItem", "ManualJob", new { jid = Model.JobID }))
 .Update(update => update.Action("UpdateItem", "ManualJob"))
 .Destroy(destroy => destroy.Action("DestroyItem", "ManualJob"))
 .Model(model =>
 {
 model.Id(p => p.ItemID);
 model.Field(p => p.ParentID).DefaultValue(Model.JobID);
 model.Field(p => p.FileName).DefaultValue("");
 model.Field(p => p.ServiceID).DefaultValue(Guid.Empty);
 model.Field(p => p.CountryCode).DefaultValue("");
 model.Field(p => p.Country).DefaultValue("");
 model.Field(p => p.Format).DefaultValue("please select...");
 model.Field(p => p.Method).DefaultValue("");
 model.Field(p => p.Quantity).DefaultValue(0);
 model.Field(p => p.ItemWeight);
 model.Field(p => p.TotalWeight);
 })
))

 

<script type="text/javascript">
var _PreventWindowClose = false;

function onGridEdit() {
var window = this.editable.element.data("kendoWindow");
window.bind("close", onWindowEditMemberClose);
}

function onGridSave() {
_PreventWindowClose = true;
}

var onWindowEditMemberClose = function(e) {
if (_PreventWindowClose) {

//$("#gridBreakDowns").data("kendoGrid").dataSource.read();
e.preventDefault();
}
_PreventWindowClose = false;
};
</script>

Boyan Dimitrov
Telerik team
 answered on 07 Jul 2016
4 answers
272 views

Hello,

I am a newbie with Kendo grid and I would like to have two grids on a page whose data  have a 1:n relation to each other.

Selecting a record in the first grid should display the corresponding records in the second grid. In my case, the data come from two tables in an sql database.

Is there a simple example that demonstrates the setup for such a case?

Thanks for your help.

Reards,

Manu

Manu
Top achievements
Rank 1
 answered on 07 Jul 2016
3 answers
479 views
I've seen similar questions being asked, but haven't been able to find exactly what I'm looking for.  I have a grid that has its grideditmode set to - "PopUp".  I'm trying to find a way to create two grid row buttons (both of which will edit the record) and depending on which button is clicked, the contents of the popup editor would change.  Is it possible to do something like this?
Danail Vasilev
Telerik team
 answered on 07 Jul 2016
13 answers
4.1K+ views
Is there any way to hide the close icon on the kendo mvc extension window?

Thank you,
Donna
Summit Insights
Top achievements
Rank 1
 answered on 06 Jul 2016
Narrow your results
Selected tags
Tags
+? more
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Iron
Krasimir
Top achievements
Rank 3
Iron
Iron
Iron
Shawn
Top achievements
Rank 1
Iron
Javier
Top achievements
Rank 1
Iron
Jean-François
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Iron
Krasimir
Top achievements
Rank 3
Iron
Iron
Iron
Shawn
Top achievements
Rank 1
Iron
Javier
Top achievements
Rank 1
Iron
Jean-François
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?