Recently I decided to make a prototype of a DotNetNuke module project that achieved these goals:
After prototyping different designs, this is the design I decided on:
I do not recommend using dynamic forms for providing module navigation. See Module Navigation Options for alternative methods. However, for this application I needed to create an unlimited amount of forms so dynamically loading the forms into a content placeholder was a perfect fit.
When you load a ASP.NET control dynamically and then click the submit button on the main page (causing a postback), the dynamically loaded control disappears and you lose all the information! As you can imagine, discovering this 2 days into the prototype makes you glad you decided to make the prototype because you are now forced to come up with a different game plan.
Denis Bauer has created a Dynamic Placeholder that maintains the viewstate of dynamically loaded controls. He also provides the source. Without this code this module simply would not work.
The module uses the following database schema. Two different tables hold the data collected by the forms. The DynamicForms_RecordData_Large is used to hold the large text data. Any Textbox control that has multiple rows will have it's data stored in this table. All other controls store their data in DynamicForms_RecordData.
You can open any of the controls in the DynamicControls folder and add or remove the standard form controls. The program will automatically gather and store the information with no other modification needed. If you desire for the forms to display the same data, simply give the controls the same ID name.
The drop-down in the example uses a database lookup to generate the list of Modules. This database lookup is placed in the Page_Init of the control in order to work properly.
The module also uses the DAL+. This provided for very rapid module development. The dynamic queries could easily be converted to stored procedures if that is desired. The paging method uses the ROW_NUMBER() function that is only available in SQL Server 2005. For this reason the module will only work with SQL Server 2005. This paging method allows the module to page through large sets of data efficiently.
Here is the code (you can also Download the code at this link):
Download the code at this link