WebGrid:结果仅在一个页面中

本文关键字:一个 结果 WebGrid | 更新日期: 2023-09-27 18:31:16

我正在使用 mvc 2010 Expressc# 中创建一个应用程序,我有一个包含此代码的视图:

@model IEnumerable<AlianIntranet.Models.DB.v_CountriesMarkets>
@{
    WebGrid grid = new WebGrid(Model, defaultSort: "CountryName");
}
<div class="centTable">
    @grid.GetHtml(
        fillEmptyRows: true,
        rowStyle: "normalRow",
        alternatingRowStyle: "alternatingRow",
        selectedRowStyle: "selectedRow",
        tableStyle: "tablemod-style",
        headerStyle: "header-grid",
        footerStyle: "footer-grid",
        columns: new[] {
            grid.Column("CountryName", style: "pamerc", header: "Country"),
            grid.Column("Market", style: "pamerc", header: "Market")
    })
</div>

我被要求只在一页中显示结果,即使它们很多。(这就是为什么我删除了一些属性,如mode)我相信一定有一个简单的方法可以做到这一点,但我找不到它。

有人可以帮我吗?提前谢谢。

WebGrid:结果仅在一个页面中

使用 WebGrid 构造函数的 canPage 参数禁用分页

@{
    var grid = new WebGrid(canPage: false,
      // ... etc
    );
}