We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The following configuration works in UI for MVC but not in UI for Core:
View:
@(Html.Kendo().Grid<dynamic>() .Name("grid") .Columns(columns => { if (Model != null) { foreach (System.Data.DataColumn column in Model.Columns) { if (column.DataType == typeof(DateTime) || column.ColumnName.Contains("Date")) { columns.Bound(column.ColumnName).Format("{0:MM/dd/yyyy}"); } else { columns.Bound(column.ColumnName); } } } }) .DataSource(dataSource => dataSource .Ajax() .Model(model => { if (Model != null) { foreach (System.Data.DataColumn column in Model.Columns) { model.Field(column.ColumnName, column.DataType); } } }) .Read(read => read.Action("ReadData", "Home")) ) .Scrollable() )
Controller:
public IActionResult Index() { return View(GetGridDataSource()); } public ActionResult ReadData([DataSourceRequest] DataSourceRequest request) { DataTable dataTable = GetGridDataSource(); for (int i = 0; i <= 80; i++) { DataRow row = dataTable.NewRow(); row["OrderID"] = i + 1; if (i % 3 == 0) { row["OrderDate"] = DBNull.Value; } else { row["OrderDate"] = DateTime.Now.AddDays(i); } row["Freight"] = (i + 1) + (i + 1) * 0.1 + (i + 1) * 0.01; row["ShipName"] = "Name " + (i + 1); row["ShipCountry"] = i <= 5 ? null : "Country " + (i + 1); dataTable.Rows.Add(row); } return Json(dataTable.ToDataSourceResult(request)); } private DataTable GetGridDataSource() { DataTable dataTable = new DataTable(); DataColumn column = new DataColumn(); column.DataType = Type.GetType("System.Int32"); column.ColumnName = "OrderID"; dataTable.Columns.Add(column); column = new DataColumn(); column.DataType = Type.GetType("System.DateTime"); column.ColumnName = "OrderDate"; dataTable.Columns.Add(column); column = new DataColumn(); column.DataType = Type.GetType("System.Decimal"); column.ColumnName = "Freight"; dataTable.Columns.Add(column); column = new DataColumn(); column.DataType = Type.GetType("System.String"); column.ColumnName = "ShipName"; dataTable.Columns.Add(column); column = new DataColumn(); column.DataType = Type.GetType("System.String"); column.ColumnName = "ShipCountry"; dataTable.Columns.Add(column); DataColumn[] PrimaryKeyColumns = new DataColumn[1]; PrimaryKeyColumns[0] = dataTable.Columns["OrderID"]; dataTable.PrimaryKey = PrimaryKeyColumns; return dataTable; }
In MVC project (expected outcome):
In Core project:
Error:
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The following configuration works in UI for MVC but not in UI for Core:
View:
Controller:
In MVC project (expected outcome):
In Core project:
Error:
The text was updated successfully, but these errors were encountered: