Click here to Skip to main content
14,643,859 members
Rate this:
Please Sign up or sign in to vote.
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

Rate this:
Please Sign up or sign in to vote.

Solution 1

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.
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, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100