سؤال

I am creating an application in c# with mvc 2010 Express and I have one view with this code:

@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>

I've been asked to display the results just in one page, even if they are a lot. (This is why I erased some properties like mode) I am sure there must be an easy way to do so, but I can't find it.

Can someone help me please? Thanks in advance.

هل كانت مفيدة؟

المحلول

Use the canPage parameter of the WebGrid constructor to disable paging

@{
    var grid = new WebGrid(canPage: false,
      // ... etc
    );
}
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top