Telerik MVC Extensions GridBindingToData sample: CRUD operations using ADO.NET DataTable (arbitrary table)?
In GridBindingToDataTableSample sample that can be found at this URL: http://www.telerik.com/community/code-library/aspnet-mvc/grid/crud-operations-using-ado-net-datatable.aspx they hard coded dataKeys and columns collection. I need a generic CRUD code that would work with Html.Telerik().Grid HTML helper.
Imagine that I will h开发者_运维百科ave some metadata TableColumnMedatata table that will contain Table/Column metadata:
table column type length pk ============================================= EmpLoc EmployeeID int 4 1 EmpLoc LocID int 4 1 --------------------------------------------- Orders OrderID int 4 1 Orders CustomerID nchar 10 0 Orders EmployeeID int 4 0 Orders OrderDate datetime 8 0 Orders ShipVia int 4 0 Orders Freight money 8 0 Orders ShipName nvarchar 80 0 --------------------------------------------- Employees EmployeeID int 4 1 Employees LastName nvarchar 40 0 Employees FirstName nvarchar 20 0
I need some suggestions on how to modify index.aspx to enable universal form to work against any DataTable retrieved from SQL Server.
Thanks, Rad
You can enumerate the table columns and create grid columns on the fly.
精彩评论