gpt4 book ai didi

c# - 如何对 WebGrid 中的多列进行排序?

转载 作者:太空宇宙 更新时间:2023-11-03 16:18:46 25 4
gpt4 key购买 nike

我在我的 ASP.NET MVC 3 (C#) 应用程序中使用 WebGrid。我想对多列进行排序(就像我们可以在 tablesorter 中做的那样)。

WebGrid 中是否可行?如果可以,我该怎么做?

最佳答案

WebGrid Helper 默认提供排序。

因此,当您编写如下所示的简单实例时,您将默认进行排序和分页:

var myGrid = new WebGrid(Model);
myGrid.GetHtml();

引用自无效链接:

Out of the box, the WebGrid provides these functions by doing Get requests and passing in a few values over the query string. The WebGrid will see these values in the new request, and adjust the output accordingly. This means that the WebGrid expects the entire set of data in each view in order to generate the paging properly.

这意味着对于较大的数据集,您会遇到性能问题,因为您需要将所有数据一次拉入内存,以便 Helper 正确计算分页和排序指标。

关于c# - 如何对 WebGrid 中的多列进行排序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14772826/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com