Run time dynamic controls in asp.net

I don’t understand that most of the developer, why they use stringbuilder to generate run time controls on page whether they know that in this case they can’t get user inserted values by using stringbuilder. So i suggest to all developers that don’t use stringbuilder for this. Please do this by using run time generating controls as per given given by example:

  1. On the aspx page use a panel for showing controls in a proper way like this and a button for saving data in

 

  • On the code behind aspx.cs page, you can generate all dynamic controls on Page_Init event

  • You can get all dynamic controls value on button click event like this

By using this method you can generate and fetch dynamic controls on asp.net page. I hope this will help you.

Tagged . Bookmark the permalink.

2 Responses to Run time dynamic controls in asp.net

  1. Sikander Ali says:

    Thanks Gaurav, this is very great in which you describe dynamic controls addition process in Asp.net page and it’s true most of developers or programmers doesn’t know how to add runtime controls and many use this process on page load event. and some are use static controls on page and use it in any another controls. But really this is the best way in all of them….

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.