mattegol
asked on
How to dynamically add form controls from a dropdownlist
I want to have a dropdownlist that contains different controls like textbox, checkbox, radiobutton and so on. When selecting one of the controls from the dropdownlist and submitting a button it should appear, selecting another it should appear under the first...
I'm going to use a database to select, insert, update the forms that the user chooses.
When choosing a control and clicking the button it inserts the controls to a table in the database, later you should be able to get the whole form on another page with the selected controls from the table.
What are your suggestions to do this?
I'm going to use a database to select, insert, update the forms that the user chooses.
When choosing a control and clicking the button it inserts the controls to a table in the database, later you should be able to get the whole form on another page with the selected controls from the table.
What are your suggestions to do this?
ASKER
Yes that's basicly what I'm looking for, would you like to show me a full example please? I haven't worked with XML that much.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks
Then when loading up the form I parsed the xml and dynamically added the controls to the form at runtime.
Adding a control dynamically at runtime is pretty simple, just create a new instance of the required control and add it to the forms controls collection. Example below:
Open in new window