Sunday, May 30, 2010

Unable to load viewstate

Most of the times when we use FormsView and GridView together in a webpage , we encounter an error,
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.

Cause of the Error: It is because, when the mode of the Formview is changed to Edit, It is not made to read Only mode once the update is finished in formsView. So we have have to make sure that when ever Item is updated in FormsView, In the FormView ItemUpdated Event , FormView mode is chaned back to readonly.

No comments:

Post a Comment