How to access the dynamically created check boxes and text boxes
-
Hello I am developing application which creates text-box and check box at run time in asp.net using c#.I am adding checkbox n textbox to panel. as Checkbox chk=new Checkbox(); this.mypanel.controls.add(chk); and text box as Textbox txt=new Textbox(); this.mypanel.controls.add(txt); by this check box get added successfully. but when i am going to get the value of that check box n text box it by Find control then it give me error as "undefined". So I want to access textboxes n checkboxes which r created runtime. Swapnil Bhavsar
-
Hello I am developing application which creates text-box and check box at run time in asp.net using c#.I am adding checkbox n textbox to panel. as Checkbox chk=new Checkbox(); this.mypanel.controls.add(chk); and text box as Textbox txt=new Textbox(); this.mypanel.controls.add(txt); by this check box get added successfully. but when i am going to get the value of that check box n text box it by Find control then it give me error as "undefined". So I want to access textboxes n checkboxes which r created runtime. Swapnil Bhavsar
What does your sample code look like? The link below may give you some hints: Accessing ASP.NET Controls Programmatically [^] Also, make sure that you should readd the dynamic controls before the postback data is processed, otherwise they get lost, to learn more about this you can see the control life cycle in MSDN.