Subject: Error Problem
Posted By: Mahenj Post Date: 1/5/2006 7:18:53 AM
Can any one help me in this problem?

I have created one control. now that control i am calling in other page but while calling that control I am getting this error. Plz help me.

Failed to load viewstate.  The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request.  For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.

Mahen
Reply By: planoie Reply Date: 1/5/2006 8:56:38 AM
This sounds like you are adding a control to a page dynamically but not adding it again when the postback occurs.  As the error message suggests, you need to reconstruct the page in such a way that the control structure matches when the page posts back.

I've seen this problem when someone attempts to have a button click handler add a control.  When the page posts back, that button click handler doesn't execute and thus the control doesn't get added back into the control hierarchy.  This results in a out-of-sync control tree.

Can you post just the code that relates to the control that is causing the problem?

-Peter

Go to topic 38153

Return to index page 403
Return to index page 402
Return to index page 401
Return to index page 400
Return to index page 399
Return to index page 398
Return to index page 397
Return to index page 396
Return to index page 395
Return to index page 394