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.
精彩评论