Tuesday, May 13, 2014

SharePoint 2010 Style Paging in SPGridview using SPGridViewPager

Hi,

We have seen lot of examples which explains how to implement paging for your SPGridView.

The implementation is pretty much simple. you need to set PagerTemplate  property to Null and rest Microsoft will do for you. The System automatically gives you the paging style of 1,2,3......... you need to write pagination events. But most of the time clients demands the same look and feel as of SharePoint where you need to show pagination in SharePoint OOTB Style.


Microsoft has provided SPGridViewPager control which allows us to display the paging as per the SharePoint OOTB Style. We just need to provide the GridView ID. This control added on the form where your SPGridView is added separately.



Note: If you are using SPGridViewPager control, then do not set PagerTemplate Property to Null which coding.

Rest if you like to change the look and feel of Pagination, you can easily extend your new class from SPGRidViewPager Class and use it.

Cool!!!!