newbie: Dynamically added controls are lost after postback

N

NotYetaNurd

Hi ,
Am very new to asp.net
i did somethign like this

CheckBox cbox = new CheckBox();
cbox.Text=txtTask.Text;
MainPnl.Controls.Add(cbox);

and when i call the same routine again the checkboxes are replaced with the
new ones...

regards,
.....
 
J

John Saunders

NotYetaNurd said:
Hi ,
Am very new to asp.net
i did somethign like this

CheckBox cbox = new CheckBox();
cbox.Text=txtTask.Text;
MainPnl.Controls.Add(cbox);

and when i call the same routine again the checkboxes are replaced with the
new ones...

You have to instantiate and add the dynamic controls on every request.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top