Hi I have need to display multiple dynamic grid on single page. I created partial view with dynamic grid binding and passing model and method name to bind data from view. First grid displays data and call data read action but rest of the grid do not display data or call method. It shows column names but no data.
This is partial view
@(Html.Kendo().Grid<
dynamic
>()
.Name(@ViewData["Name"].ToString())
.Columns(columns =>
{
foreach (System.Data.DataColumn column in Model.Columns)
{
columns.Bound(column.ColumnName);
}
})
.Pageable()
.Sortable()
.Filterable()
.Groupable()
.Scrollable()
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(50)
.Model(model =>
{
foreach (System.Data.DataColumn column in Model.Columns)
{
var field = model.Field(column.ColumnName, column.DataType);
}
})
.Read(read => read.Action(@ViewData["ActionName"].ToString(), "RunData"))
)
)
In main view I am passing list of datatable and in partial view it is getting datatable from ajax call. I have created 3 separate method (ReadData1, ReadData2, ReadData3) in RanData controller.
Thanks in advance.
@model List<
System.Data.DataTable
>
@{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<
div
>
@{Html.RenderPartial("dGrid", Model[0], new ViewDataDictionary { { "ActionName", "ReadData1" }, { "Name", "Grid1" } });}
</
div
>
<
div
>
@{Html.RenderPartial("dGrid", Model[1], new ViewDataDictionary { { "ActionName", "ReadData2" } , { "Name", "Grid2" } });}
</
div
>
<
div
>
@{Html.RenderPartial("dGrid", Model[2], new ViewDataDictionary { { "ActionName", "ReadData3" }, { "Name", "Grid3" } });}
</
div
>