ASP.NET MVC 3.0 Replacing MvcGrid Pager
For example if i have an implementation of my own helper and i don't like the default WebGrid pager, how may i replace it?
Is it possible to Replace MvcGr开发者_C百科id Pager to change it to my custom one?
I did search and didn't find any thing, only what i think i need to do is to render my one and append it to current WebGrid table as a table footer using jQuery.
Is there any another more simple way of doing this?
You can disable the pager by setting the mode to numeric and setting numericLinksCount to zero. Ex:
<div id="gridSample">
@( var grid = new WebGrid(rowsPerPage: Model.GridRowsPerPage);
grid.Bind(source: Model.ListData,
rowCount: Model.TotalRowCount,
autoSortAndPage: false)
)
@grid.GetHtml(mode: WebGridPagerModes.Numeric, numericLinksCount: 0)
<!--...custom paging here...-->
</div>
Then you're free to render your own paging links using a combination of rows per page and total row count. (Each link should pass the "page" parameter) Easy once you disable the built-in pager... hope that helps.
You can change the Pager Mode on the WebGrid
see WebGridPagerModes
Other than this you can style the pager with CSS.
精彩评论