Telerik MVC 扩展 GridBindingToData 示例:使用 ADO.NET DataTable(任意表)进行 CRUD 操作?
在 GridBindingToDataTableSample 示例中,可以通过以下 URL 找到: http:// /www.telerik.com/community/code-library/aspnet-mvc/grid/crud-operations-using-ado-net-datatable.aspx 他们对数据键和列集合进行了硬编码。 我需要一个可以与 Html.Telerik().Grid HTML 帮助器一起使用的通用 CRUD 代码。
想象一下,我将有一些元数据 TableColumnMedatata 表,其中将包含表/列元数据:
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
我需要一些有关如何修改 index.aspx 的建议,以启用通用表单来处理从 SQL Server 检索的任何 DataTable。
谢谢, 拉德
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 have 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以枚举表列并动态创建网格列。
You can enumerate the table columns and create grid columns on the fly.