分页链接在webgrid中重复

时间:2013-09-06 07:54:39

标签: asp.net-mvc pagination webgrid

继承我的WebGrid的代码:

 @{ 
<style type="text/css">
    .webGrid { margin: 4px; border-collapse: collapse; width: auto; }
    .header { background-color: gray; font-weight: bold; color: #FFF; }
    .webGrid th, .webGrid td {border: 1px solid #C0C0C0; padding: 5px; }
    .alt { background-color: lightblue; color: #000; }
    .footer { padding:10px; background-color:lightgray;color:black;}
    .birthdate
    {   width:200px;
    }
    .id
    {width:50px;
    }     
</style>


var grid = new WebGrid(null,
            defaultSort: "",
            rowsPerPage: 10,
            canPage:true,
            ajaxUpdateContainerId:"grid",
            selectionFieldName:"SearchString",
            sortFieldName:"SortColumn",
             sortDirectionFieldName:"SortOrder");
@grid.Bind(Model, autoSortAndPage: false, rowCount: ViewBag.tr);



<div id="grid">
@grid.GetHtml(
    tableStyle: "webGrid",
    headerStyle: "header",
    alternatingRowStyle: "alt",
    footerStyle: "footer",
    columns: grid.Columns(
        grid.Column("OrderID", header:"ID", style:"id"),
        grid.Column("ShipName", header:"ShipName", style:"birthdate"),
        grid.Column("ShipAddress", header:"ShipAddress", style:"birthdate"),
        grid.Column("RequiredDate", header:"RequiredDate", style:"birthdate"),
        grid.Column("ShipPostalCode", header:"ShipPostalCode", style:"birthdate")
    )
)

@grid.Pager(
mode: WebGridPagerModes.All,
numericLinksCount: 9,
firstText: "First",
lastText: "Last",
previousText: "<",
nextText: ">")
</div>

}

我想摆脱被包围的东西。任何想法?? getrid

0 个答案:

没有答案