add controls dynamically to table

C

chad

Hi,

I am trying to add controls (textboxes, dropdownlist,...) dynamically
to the table. The problem is when the page is posted back, all of the
controls disappear and the table is reset to empty. I need to be able
to capture the data saved by the user that posted back from these
controls to save to the database. Btw, the enableviewstate is true.

Can someone please help?

The snippet below:

private void Page_Load(object sender, System.EventArgs e)
{
if(!IsPostBack)
{
BindTable();
}
}

private void BindTable()
{
....
}

Thanks
Chad
 
S

Steve C. Orr [MVP, MCSD]

You need to re-create the controls after each postback.
You can save variables into viewstate manually if that helps you keep track
of things.
 

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

Top