My master page has a content place holder, and my page has 2 rad grids, within separate asp:panels. On a dropdown selection, respective grid is loaded into the page.
- I select grid 1 from dropdown
- Click on add new row, but dont cancel or add any new row(let that new row remain open)
- Select grid2 from dropdown, let the grid load
- Again select grid1 from dropdown
At this point, the grid1 opens, but i get following javascript error.
Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: 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.
Any idea about the issue. I read in some forums that the issue might be, using same type of control in a single content place holder. Any suggestion on solution ???
I cleared controls of both grids on dropdown selection change, before rebinding them. It solved my problem.
radgrid1.Controls.Clear(); radgrid2.Controls.Clear();