Click here to Skip to main content
15,946,898 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am having an aspx page. It initially will have the following controls.
5 lables, 3 text boxes, 2 dropdown boxes,
3 buttons.
One of my button is 'ADD'.
The function to be done on click of the 'ADD' button is to add another set of same controls , i.e., 5 lables, 3 text boxes, 2 dropdown boxes with different IDs.
The previous controls should remain in the page.With them , same controls should be added dynamically.
User can press the 'ADD' button more than 20 times if needed to add the above controls more than 20 times

Kindly help with adding these controls dynamically and how to handle them and retrieve values from these new controls.

Please dont mind my bad english.


1 solution

You can add them as often as you like. However, they will not be restored on a postback unless you create a mechanism to track them using a hidden control to contain values telling you how to recreate them. There is no viewstate for dynamically created controls. It's basically a bad idea. The best way to do this is to make all your actions occur using AJAX with jquery, that way there's no postback and no need to recreate the controls.
Share this answer
Naveen_143 28-Nov-12 2:03am    
Hi,thanks for your reply.I have to do this in VB.Net V1.0 ... there are very less options in this version of VB. Can you suggest me and work arround in this version.?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900