Hi,
Please tell me how to bind a kendo grid dynamically using a datatable?
I am trying to use the following script but its returning few extra fields [EX: DataView, RowVersion, Row, IsNew, IsEdit] which I do not want to display in my grid.
@model System.Data.DataTable
@(Html.Kendo().Grid(Model).Name("GridExcel")
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("Read_Excel", "Home")))
.Columns(columns =>
{
if (Model != null)
{
foreach (System.Data.DataColumn column in Model.Columns)
{
if (column.ColumnName != "DataView" && column.ColumnName != "RowVersion" && column.ColumnName != "Row" && column.ColumnName != "IsNew" && column.ColumnName != "IsEdit")
{
columns.Bound(column.DataType, column.ColumnName);
}
}
}
})
.Pageable()
.Sortable()
.Scrollable()
.Filterable()
)
Please tell me how to bind a kendo grid dynamically using a datatable?
I am trying to use the following script but its returning few extra fields [EX: DataView, RowVersion, Row, IsNew, IsEdit] which I do not want to display in my grid.
@model System.Data.DataTable
@(Html.Kendo().Grid(Model).Name("GridExcel")
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("Read_Excel", "Home")))
.Columns(columns =>
{
if (Model != null)
{
foreach (System.Data.DataColumn column in Model.Columns)
{
if (column.ColumnName != "DataView" && column.ColumnName != "RowVersion" && column.ColumnName != "Row" && column.ColumnName != "IsNew" && column.ColumnName != "IsEdit")
{
columns.Bound(column.DataType, column.ColumnName);
}
}
}
})
.Pageable()
.Sortable()
.Scrollable()
.Filterable()
)