Understanding Dynamic Server Controls in ASP.NET
In such cases, it is not possible to add a pre-determined number of controls to the web page during design time. So, what is the way out of this situation?
You have to create those server controls dynamically in the web application and then attached it to the web page. The number of controls that have to be placed will be decided on some other factor or it might come from the database.
However you will decide that type of controls that need to be used. Upon deciding this you will have to add a placeholder in the web page during design time. When the program is run, you can add controls to this place holder dynamically.
For example to add a label and textbox control to the web page, you might be using code that is similar to,
Dim AuthorName As New Label
You can also attach events to the dynamically created controls as per your need.
| Why should you go for Server Controls | Advantages of using .NET Server Controls | Understanding ASP.NET Server Controls | Creating Web Server Controls | Server Side Controls in ASP.Net | Creating Custom Server Controls | Server Controls in ASP.NET Web Page | Using Html Server Controls in your Web Pages | Understanding Dynamic Server Controls in ASP.NET | Using ASP Server Controls Templates | Developing ASP.NET Server Controls | Setting properties for ASP.NET Custom Server Controls | Implementing ASP.NET Server Side Controls | Creating Professional ASP.NET Server Controls |