Problem with dynamic controls

GornHorse

Centurion
Joined
May 27, 2003
Messages
105
Location
Australia
Hi There,

I have two tables on the same asp.net page. One, tblAccounts, and the other tblDocs.

tblAccounts has textboxes & dropdowns in it for the user to provide data. It has a radiobuttonlist that is autopostback, that determines which textbox controls are visible within the next column of the table. The visible textbox has an autopostback on it which creates a new table row ready for data entry.

Once the autopostback of the visible control is called, a check is performed - if a result is found, data is populated in the tblDocs. tblDocs has two buttons within its' last column, btnYes and btnNo.

On the postback, I dynamically recreate the tblAccounts, but I cannot dynamically recreate the tblDocs, because when I do, it affects the action of the autopostback that is set up for the radiobuttons in the tblAccounts.

I have included part of my code as a txt attachment.

The problem with this is, that when the main button is pressed, the postback occurs, but no it does not register that the checkbox has been selected , because the tblDocs has not been recreated.

I need a way of recreating the tblDocs on each postback without it affecting the way that the controls in tblAccounts are supposed to function.

If you need further info on this, let me know.

P.S. This is urgent!!??
 

Attachments

The problem that seems to be happening is that the controls added on runtime are not mantaining the Viewstate, and normally this happens when we add the controls to the control collection after having initialize all the information related to that control, when we should to exactly the oposite, because the Viewstate is started after the new object being added to the control collection.
This is what i can say after a quick look at your question and code, but if the problem presist, tell me something and i'll try to take a better look, and i'll need a copy of page and an xml file to test with.

Hope that this could be of some help,

Nuno Godinho
 
Back
Top