Hello, I would like to develop a library to dynamically generate FormViews for the usual content management tasks; the formview's internal controls (TextBox, DropDownlist ...) must match the schema of a certain DB table that is extracted at run-time. In few words, I need to create at runtime the <ItemTemplate> and <EditItemTemplate> sections of the <FormView> control.
Unfortunately, in the last versione of ASP.Net 2.0 these templates could be created directly only at design-time and not at runtime. Investigating about, I have found a solution:
- to create on the fly a Web Control file containg the <ItemTemplate> (or similar) sections (i.e.: MyTemplate.ascx)
- to assign the loaded control to the ItemTemplate property of the FormView (i.e.: formView1.ItemTemplate=LoadControl("MyTemplate.ascx")
From my tests, this solution reveals some bugs and I do not know if it depends on some incorrect methods that I use or on internally ASP.Net problems.
In particular, when generating a formview for viewing records, when paging I get an error.
More seriously, reading a MSDN post of the ASP.Net team (see http://lab.msdn.microsoft.com/ProductFeedback/viewFeedback.aspx FeedbackId=d9c93c38-71c7-4fbd-9667-264a1456ba8f ), it seems that the dynamically created EditItemTemplate is not currently able to update the underlying datasource; this problem is reported as "not solved - postponed". This note referred to the ASP.Net 2.0 Beat version, so I do not know if the problems has been solved in the final release.
Has anyone faced a similar problem finding a really working solution
Thanks for any suggest,
Davide

Dynamically generation of ItemTemplate and EditItemTemplate in FormView control
Steven13174206
Please post the question on: http://forums.asp.net/.
Mystikef
andre_eads
Thanks PJ, I will forward this message on the ASP.Net forums.
Thanks also for your help in my last question about the Access' table schema extraction.
Davide