Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB.NET
Hello,
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.
 
Thanks.
Posted 19-Nov-12 0:27am

1 solution

Rate this: bad
good
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.
  Permalink  
Comments
Naveen_143 at 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)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 509
1 Nirav Prabtani 338
2 OriginalGriff 215
3 _Amy 165
4 Abhinav S 160
0 OriginalGriff 7,715
1 Sergey Alexandrovich Kryukov 6,911
2 Maciej Los 3,954
3 Peter Leow 3,698
4 CHill60 2,742


Advertise | Privacy | Mobile
Web02 | 2.8.140721.1 | Last Updated 19 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100