GornHorse Posted June 8, 2004 Posted June 8, 2004 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!!??AttachedCode.txt Quote
Mutley Posted June 8, 2004 Posted June 8, 2004 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 Quote
Moderators Robby Posted June 10, 2004 Moderators Posted June 10, 2004 to reiterate what Mutley said, when placing controls at runtime, you need to do this every time not just during not ispostback. You will need to add your objects into the state bag. THere's a good start http://msdn.microsoft.com/msdnmag/issues/03/02/CuttingEdge/ Quote Visit...Bassic Software
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.