Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
885
Viewstate is corrupted
posted

When I reset the web data grid after resetting my form and data grid, I am unable to re-use my page again. I am getting an error that my viewstate is corrupted in the webdatagrid behaviors section.

Basically, I have a few drop-down combo boxes and a data grid. Based on a combination of factors, the web data grid is either editable or not editable. When the form is editable, it will define the columns and set up an editing core object, and add it to the data grid. 

When the user decides to restart/reset the page, to start over with their selections, the form becomes unusable, no events take place, and I get an error through the Chrome Console stating that the viewstate is corrupted.

Uncaught Sys.WebForms.PageRequestManagerServerErrorException: Sys.WebForms.PageRequestManagerServerErrorException: Infragistics.Web.UI.GridControls.Behaviors ViewState is corrupted.

This is what I do when I reset the datagrid:

dg.ClearDataSource();
dg.Columns.Clear();
dg.Rows.Clear();

if ((bool)Session["EditMode"] == true)
{
    dg.Behaviors.EditingCore.RowUpdating -= EditingCore_RowUpdating;
    dg.Behaviors.EditingCore.Enabled = false;
    dg.AutoGenerateColumns = true;
    dg.DataKeyFields = "";
    Session["EditMode"] = false;
}

Parents
No Data
Reply
  • 885
    Verified Answer
    posted

    Seems that when I "disable" the view state of the grid, everything works well. I don't seem to notice any reduced functionality and I did read the blog about viewstate, so
    it is now disabled along with the view state of numerous other non-essential controls such as labels. Still debating the Web Drop Down controls or whether to do it for the
    page itself. :-)

    Paul

Children