简体   繁体   English

如何在C#中为自定义网格创建分页和排序

[英]How to Create Paging and Sorting for Custom Grid in C#

I need to create my own grid which will have customized paging and sorting. 我需要创建自己的网格,该网格将具有自定义的分页和排序功能。

<MY:Grid id="grid" runat="server">
<columns>
Columns....
</Columns>
</MY:Grid>

I need to create the above grid such that customized paging and sorting is available whereever the grid is applied for entire application. 我需要创建上述网格,以便在将网格应用于整个应用程序的任何位置都可以使用自定义的分页和排序。

I have answered a similar question here How does pagination work in ASP.NET(Using VB.NET)? 我在这里回答了类似的问题, 如何在ASP.NET(使用VB.NET)中进行分页? . You should not enable built-in pagination and sorting of asp.net grid. 您不应该启用内置分页和asp.net网格排序。

Your main task is to figure out the delta of your data that you need to display on your grid. 您的主要任务是找出需要在网格上显示的数据增量。 Put your logic related to sorting and pagination in DB. 将与排序和分页相关的逻辑放入数据库。 Having the logic in DB reduces the network usage. 将逻辑包含在DB中可以减少网络使用量。 Once you have desired dataset with you, you bind it to your grid. 有了所需的数据集后,将其绑定到网格。 HTH. HTH。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM