By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,913 Members | 1,356 Online
Bytes IT Community
Submit an Article
Got Smarts?
Share your bits of IT knowledge by writing an article on Bytes.

How To Change Pager Style of GridView

P: 85
Let us try to change the default pager style of the GridView.The default pager style is 1 2 3 4..

Let us make it First Previous Next Last.

For that first of all write a simple css like
Expand|Select|Wrap|Line Numbers
  1.   <style type="text/css">
  2.         .cssPager td
  3.         {
  4.             background-color: #CCC;
  5.             font-size: 18px;
  6.             padding-left: 4px;
  7.             padding-right: 4px;
  8.         }
  9.     </style>
  10.  
Now let us see how we will write the GridView to change the pager style, the markup or grid view will be like this:
Expand|Select|Wrap|Line Numbers
  1. <asp:GridView ID="gvPager" runat="server" AutoGenerateColumns="False" Width="100%"
  2.                     AllowPaging="True" OnPageIndexChanging="gvPager_PageIndexChanging" PageSize="5" EmptyDataText ="No Records Found">
  3.                     <PagerStyle CssClass="cssPager" />
  4.  
  5. <PagerSettings Mode="NextPreviousFirstLast" PageButtonCount="4" PreviousPageText="Previous" NextPageText="Next" FirstPageText="First" LastPageText="Last" />
  6. <Columns>
  7. .
  8. .
  9. .
  10. .
  11. </Columns>
  12.  </asp:GridView>
  13.  
Chillas
Addan
Aug 2 '12 #1
Share this Article
Share on Google+