ASP.NET DataGrid and custom paging

橙三吉。 提交于 2019-11-29 11:37:08

There is an error in your ASPX: to wire up the PageIndexChanged event handler use the property OnPageIndexChanged (not PageIndexChanged as in your code):

<asp:DataGrid ID="myGrid" runat="server"
   OnPageIndexChanged="MyGrid_PageIndexChanged"  /// <--- here's the error
   ...

Then, if you have AllowCustomPaging="true", you must ensure that the GetDataFromInternetSomehow() method will only return the data for the currently selected page, e.g. pass the current page to the method and return only the corresponding data:

GetDataFromInternetSomehow(e.NewPageIndex);

Otherwise, disable custom paging and it will just work (but all data will be loaded everytime).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!