[原]解决DataGrid翻页的问题

问题是这么出现的,我翻到第3页后,然后在查询文本框里输入东西查询,这时就提示:
Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Web.HttpException: Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount.

上面英文大意就是说CurrentPageIndex 必须大于等于0并且小于PageCount,看懂这个就好办了。

DataGrid1.CurrentPageIndex = 0//加上这个就是为了避免出现:Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount
DataGrid1.DataBind();

就这样,我的问题解决了。

posted @ 2007-03-05 21:59  Kenny田  阅读(676)  评论(1编辑  收藏  举报