I am working on an ASP.net MVC project where I need to show data from database using KendoUI Grid features. It works well but whenever I am putting dot in my datatable column name, it shows nothing. I have tried to serialize them to avoid this problem but still it is not working. Here is my code,
public ActionResult Read([DataSourceRequest] DataSourceRequest request) { DataTable products = Products(); var result = JsonConvert.SerializeObject(products.ToDataSourceResult(request)); return Json(result, JsonRequestBehavior.AllowGet); } public DataTable Products() { // Here we create a DataTable with four columns. DataTable table = new DataTable(); table.Columns.Add("Dosage.Dosage", typeof(int)); table.Columns.Add("Drug", typeof(string)); table.Columns.Add("Patient", typeof(string)); table.Columns.Add("Date", typeof(DateTime)); // Here we add five DataRows. table.Rows.Add(25, "Indocin", "David", DateTime.Now); table.Rows.Add(50, "Enebrel", "Sam", DateTime.Now); table.Rows.Add(10, "Hydralazine", "Christoff", DateTime.Now); table.Rows.Add(21, "Combivent", "Janet", DateTime.Now); table.Rows.Add(100, "Dilantin", "Melanie", DateTime.Now); return table; } Here is my grid,
@model System.Data.DataTable <div class="container-fluid"> <div class="row"> <div class="col-xs-18 col-md-12"> @(Html.Kendo().Grid<dynamic>() .Name("grid") .Columns(columns => { }) .Pageable() .Sortable() .Scrollable() .Filterable() .HtmlAttributes(new { style = "height:550px;" }) .DataSource(dataSource => dataSource .Ajax() .PageSize(20) .Read(read => read.Action("Read", "Home")) ) ) </div> </div>