Hi guys.
I'm looking for example of Kendo UI grid working with dynamic data.
I tried this one:
http://www.kendoui.com/code-library/mvc/grid/binding-to-datatable.aspx
and it is working well with displaying data, but I was not able to find example with other operations (Add,Edit, Delete).
I tried add them by myself and got next exception:
The model item passed into the dictionary is of type 'System.Data.DataRowView', but this dictionary requires a model item of type 'System.Data.DataTable'.
I found that similar question was asked here:
http://www.kendoui.com/forums/kendo-ui-complete-for-asp-net-mvc/grid/problem-with-crud-operation-with-data-table-as-model.aspx
but it is still without an answer and this thread seems to be closed. Could You please tell me what should be the problem or give me some link
to working example with supported CRUD for Data table as Model.
Here is my code of Index.cshtml:
@model System.Data.DataTable
@(Html.Kendo().Grid(Model)
.Name("Grid")
.Columns(columns =>
{
foreach (System.Data.DataColumn column in Model.Columns)
{
columns.Bound(column.ColumnName);
}
})
.Pageable()
.Sortable()
.Scrollable()
.Filterable()
.Groupable()
.Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateName("DataTableEditor"))
.DataSource(dataSource => dataSource
.Ajax()
.Model(model => model.Id("ProductID"))
.Model(model =>
{
model.Id("ProductID");
foreach (System.Data.DataColumn column in Model.Columns)
{
model.Field(column.ColumnName, column.DataType);
}
})
.Read(read => read.Action("Read", "Home"))
.Update(upd => upd.Action("Update", "Home"))
)
)
I'm looking for example of Kendo UI grid working with dynamic data.
I tried this one:
http://www.kendoui.com/code-library/mvc/grid/binding-to-datatable.aspx
and it is working well with displaying data, but I was not able to find example with other operations (Add,Edit, Delete).
I tried add them by myself and got next exception:
The model item passed into the dictionary is of type 'System.Data.DataRowView', but this dictionary requires a model item of type 'System.Data.DataTable'.
I found that similar question was asked here:
http://www.kendoui.com/forums/kendo-ui-complete-for-asp-net-mvc/grid/problem-with-crud-operation-with-data-table-as-model.aspx
but it is still without an answer and this thread seems to be closed. Could You please tell me what should be the problem or give me some link
to working example with supported CRUD for Data table as Model.
Here is my code of Index.cshtml:
@model System.Data.DataTable
@(Html.Kendo().Grid(Model)
.Name("Grid")
.Columns(columns =>
{
foreach (System.Data.DataColumn column in Model.Columns)
{
columns.Bound(column.ColumnName);
}
})
.Pageable()
.Sortable()
.Scrollable()
.Filterable()
.Groupable()
.Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateName("DataTableEditor"))
.DataSource(dataSource => dataSource
.Ajax()
.Model(model => model.Id("ProductID"))
.Model(model =>
{
model.Id("ProductID");
foreach (System.Data.DataColumn column in Model.Columns)
{
model.Field(column.ColumnName, column.DataType);
}
})
.Read(read => read.Action("Read", "Home"))
.Update(upd => upd.Action("Update", "Home"))
)
)