Hello,
I have a tab stripe and the tab Content which is a grid bound to datatable gets loaded with Ajax call like this
@(Html.Kendo().TabStrip()
.Name("myKendoTabs")
.Animation(animation =>
{
animation.Enable(false);
})
.SelectedIndex(0)
.Items(t =>
{
t.Add().Text("Objektliste").LoadContentFrom("GetObjectsforAdress", "AdressActivity", new { strAdressID = ViewBag.SelAdressID });
})
)
And the GetObjectsforAdress method in Controller Returns a partial view
return PartialView("DocumentList", ds.Tables[0]);
and the partialview is like this
@(Html.Kendo().Grid(Model)
.Name("Grid_ObjActivity")
.Scrollable()
.HtmlAttributes(new { style = "height: 300px;" })
.DataSource(dataSource1 => dataSource1
.Ajax()
.PageSize(100)
.Model(model1 =>
{
if (Model != null)
{
foreach (System.Data.DataColumn ocolumn in Model.Columns)
{
model.Field(ocolumn.ColumnName, ocolumn.DataType);
}
}
})
.ServerOperation(false)
)
.Resizable(resize => resize.Columns(true))
.Columns(columns =>
{
if (ViewBag.ObjListHeader != null)
{
for (int j = 0; j < ViewBag.ObjListHeader.GetLength(0); j++)
{
columns.Bound(ViewBag.ObjListHeader[j, 0]).Title(ViewBag.ObjListHeader[j, 0]).Width(120);
}
}
})
.Selectable(selectable => selectable
.Mode(GridSelectionMode.Single))
.Filterable(filterable => filterable
.Extra(false)
.Operators(operators => operators
.ForString(str => str.Clear()
.StartsWith("Starts with")
.IsEqualTo("Is equal to")
.IsNotEqualTo("Is not equal to")
))
)
.Groupable()
.Reorderable(r => r.Columns(true))
.Resizable(r => r.Columns(true))
)
The Problem is when the tab is selected then GetObjectsforAdress method is called twice. Loads once and again loads. Not sure why it is called twice.
Can you please suggest what am i doing wrong here.
Thanks
Anamika