Dynamically Copy/Create the Full Structure of an Asp.NET Grid View
Ok so I have a GridView created on my .aspx page and it has the exact structure I want. How make copies of it in the code-behind? Copies with the exact same structure of TemplateFields and ItemTemplates?
If copying is not possible, how can I reproduce the GridView in the code-behind? Add the TemplateFields, ItemTemplates, etc.
Why 开发者_如何学Pythonam I doing it this way? I need a separate, identical GridView for each column of a database. I've been looking around and only found one resource for making the grid dynamically (see the resource below). Given my time constraints, I'd like to simply copy the one I already have.
Resource: http://bytes.com/topic/asp-net/answers/624380-gridview-generated-programmatically
You could create a User Control with the gridview. This will allow you to create several instances of that structure. If it is created programatically you may be better off creating a Web Server Control that will allow you better control on the page.
精彩评论