views:

24

answers:

0

Hi, I am getting the following viewstate error when I add a row to the last page of the gridview control with custom paging enabled. this error occurs when row count of last page is equal to the page size (works first time, fails when doing the same on next page). any idea what might be causing it? custom paging is implemented using the code from the following links. basically I need to implement paging in Gridview by retrieving only the data for the current page from the database and bind it in the code without using any data source control. the following solution works except with that issue.

http://stackoverflow.com/questions/2518968/problem-with-efficient-gridview-paging-without-datasource-control http://www.codeproject.com/KB/aspnet/GridViewNeatPaging.aspx

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.