eriesABCEK
New Member
I have two user controls (both being datagrids) which I load on the page depending on the users credential. The datagrids provide the ability to update the rows and have textboxes in edit template. The problem is when I try to update the datagrid I get the following error - -<BR>"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."<BR><BR>I realize that the datagrid has different set of controls in the item template and edit template and is unable to maintain its viewstate. I have tried loading the controls in page_load. I have also tried to load them in page_init or page_prerender but nothing works.