Possible to have the GridPager at the top

Mar 22, 2013 at 4:30 PM
Hello,

I am wondering if it would be possible to put the _GridPager at the top of the table instead of the bottom? I see this line of code here:

@if (Model.EnablePaging && Model.Pager != null && Model.Pager.PageCount > 1)

The problem is, if I move that block of code to the top of the table, Model.Pager.PageCount is 0 and thus never renders. Is there anyway to set this value before? Thanks!
Coordinator
Mar 23, 2013 at 4:39 AM
Hi,

It happens, that grid queries data from your collection and calculate PageCount property only when application try to get ItemsToDisplay property.

You can modify condition like:

@if (Model.EnablePaging && Model.Pager != null && Model.ItemsToDisplay.Any() && Model.Pager.PageCount > 1)

P.S: I reccommend you create a copy of default _Grid.cshtml partial view, modify it and render grid via @Html.Grid(Model,"_CustomGrid").Columns(...),, because in the feature default layout can be modified.