Search code examples
asp.netgridview

PagerSetting Modes in ASP.NET GridView Control - First Prev 1 2 3 Next Last


In GridView Control I want pagination like- First Prev 1 2 3 4 Next Last. In my below code I'm able to do First Prev Next Last but not sure how to show number between Prev Next. Please advice.

Thanks.


Solution

  • You need to add a PagerSettings tag to your gridview, something like:

    <PagerSettings Mode="NumericFirstLast" PageButtonCount="4"  FirstPageText="First" LastPageText="Last"/> 
    

    or possibly a PagerTemplate for more control over the output.

    PagerSettings - MS documentation

    PagerTemplate - MS documentation