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
580
Reset dataviewstate for webdatagrid
posted

Hi team,

                I am using your webdatagrid in one of my applications.I have enabled the viewstate for this grid. ( viewstatemode=enabled,enableddataviewstate=true,enableajaxviewstate=true)

Now i want to reset/delete the viewstate of this grid at click of a certain button. For doing this i bind the data to the grid again at the click event of that button...(this.RolesDataGrid.DataSource = LogicSEMaster.GetAllRoleDetails();
                this.RolesDataGrid.DataBind();)

However, my viewstate is still persisted.Can you please guide me as how do i reset the viewstate of the grid.

Please note i dont want to turn the viewstate OFF .I just want to get rid of the data which is there in the viewstate.

Parents
  • 33839
    Verified Answer
    posted

    HI yadusaxena,

    When you rebind the grid to its data source, the data objects are reset and it will save the new data.  I'm not sure what you want to clear out of view state.  It mostly saves properties of the grid or its behaviors.  You could possibly call ClearDataSource() before reassigning the grid source if you're actually changing it; that function will clear some other internal variables.

    regards,
    David Young 

Reply Children
No Data