开发者

How to get to page1 when I refresh my gridview?

开发者 https://www.devze.com 2023-02-06 00:50 出处:网络
I have a gridview i开发者_高级运维n my webform. In my search I got to page 4 for example, now I need to refresh the gridview and go to page 1.

I have a gridview i开发者_高级运维n my webform.

In my search I got to page 4 for example, now I need to refresh the gridview and go to page 1.

How do I do that?


Upon the postback assign the GridView.PageIndex property to 0

mygridView.PageIndex = 0;

Have a look at MSDN http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.pageindex.aspx


You update a DataGrid but changing the DataSource, after this you need to call DataBind on the GridView. And you can use SetPageIndex to change page. Which will also trigger the OnPageIndexChanged event.


Reset the PageIndex value

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.pageindex.aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消