I am trying to use a Kendo Grid generically as a partial view. Kendo requires either a type defined or a datatable to instantiate the grid in a razor view
@(Html.Kendo().Grid<object>() or @(Html.Kendo().Grid(dataTable)
My issue is i want to use the Grid for whatever object, not a specific one.
@(Html.Kendo().Grid<object>()
.Name(Model.MetricName)
.Resizable(resizing => resizing.Columns(true))
.Reorderable(reorder => reorder.Columns(true))
.Sortable(sorting => sorting.Enabled(true))
.Pageable(pager => pager.PageSizes(new int[] { 10, 15, 20, 50 }))
.ColumnMenu()
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action(Model.MetricName, "AdHocReport", new { metricId = Model.MetricId }))
)
)
by using Object i am able to dynamically load the data returned from the ajax .read method. However the issue is with dates. They are returned in JSON format.
Ive tried this method and I still get JSON string representation of the date
Kendo ASP.NET MVC helper Grid generic class
Is there a way to define the type of grid from a string representation of the type? So lets say i have a string property on the viewModel that is the type of the grid. How can i say Grid ?
ive tried using reflection to instantiate the type but i get the infamous "you are using a variable like a type"
This is driving me nuts... any and all help would be greatly appreciated
Aucun commentaire:
Enregistrer un commentaire