Adding dynamic controls

Within an existing .net system at work, there was a requirement to generate dynamic asp.net controls. Depending on certain business factors, the controls for data entry would either be textboxes or dropdownlists. In both cases the fields would be mandatory.

The solution involved database tables which contained the configuration for each setup, i.e txtboxes or dropdownlists and whether or not the field was mandatory. On entering the aspx page the code behind checks the configuration, creates the controls dynamically and adds them to a placeholder.

Advertisements