开发者

Creating a generic data editing user control

开发者 https://www.devze.com 2022-12-20 07:04 出处:网络
I have a user control which has a Gridview and 开发者_高级运维a listview, I want to make this control generic so that I can just pass the type of the class I want to edit, which would be a linq entity

I have a user control which has a Gridview and 开发者_高级运维a listview, I want to make this control generic so that I can just pass the type of the class I want to edit, which would be a linq entity, and then it would automatically do the rest, so far I havent had any success and I was wondering if anybody knows a tutorial or some info about doing this?


You might want to switch from a ListView with a GridView to using the DataGrid from the WPF Toolkit. It has a property AutoGenerateColumns which allows it to create columns from any collection of data you throw at it, like from a LINQ query. I think it also allows editing for basic types, though I may be wrong about that since I rarely use the DataGrid.

A basic article about it is located here: http://www.codeproject.com/KB/WPF/WPFDataGrid.aspx

Note: This may not apply to asp.net.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号