DataGridAllowCustomPaging.aspx font size:
C# Source: DataGridAllowCustomPaging.aspx   fetchData_oledb.cs   details_plans.aspx   
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>

<html>
<head>
<title>Custom Paging with AutoIncrement Data Model</title>
<link rel="stylesheet" href="/shared/netdemos.css">

<script language="C#" runat="server" src="fetchData_oledb.cs" />

<script language="C#" runat="server">
   int rowCount, startIndex;

   void Page_Load ( Object src, EventArgs e ) {
      // need to do this only on initial load
      if ( !IsPostBack ) {
         // get total records count of data source
         // used for calculating virtual page count ( VirtualItemCount/PageSize )
         myGrid.VirtualItemCount = countRows ( );
         // initialize grid
         bindGrid ( );
      }
   }

   void setPagerMode ( Object src, EventArgs e ) {
      myGrid.PagerStyle.Mode = ( chkNumbers.Checked ) ?  
         PagerMode.NumericPages : PagerMode.NextPrev;
      startIndex = myGrid.CurrentPageIndex * myGrid.PageSize;
      bindGrid ( );
   }

   void setPage ( Object src, DataGridPageChangedEventArgs e ) {
      myGrid.CurrentPageIndex = e.NewPageIndex;
      startIndex = myGrid.CurrentPageIndex * myGrid.PageSize;
      bindGrid ( );
   }

   void bindGrid ( ) {
      myGrid.DataSource = fetchView ( );
      myGrid.DataBind ( );
      lblTracker.Text = "Page " + ( myGrid.CurrentPageIndex+1 ) + " of " + 
         myGrid.PageCount;
   }

   DataView fetchView ( ) {
      // define the query for data segment
      string query = "SELECT top " + myGrid.PageSize + 
         " * FROM Plans where PlanNo > " + startIndex;

      // fetch data and return sorted DataView
      DataView gridView = fetchData ( query, "plans" ).Tables [ 0 ].DefaultView;
      gridView.Sort = "Design, PlanNo";
      return gridView;
   }

   int countRows ( ) {
      // specify the data source
      OleDbConnection myConn = new OleDbConnection (
         "Provider = Microsoft.Jet.OLEDB.4.0; Data Source=" + 
         Server.MapPath ( "~/app_data/plans.mdb" ) );

      string query = "SELECT Count ( * ) FROM Plans";
      OleDbCommand myCommand = new OleDbCommand ( query, myConn );
      myConn.Open ( );
      rowCount = ( int ) myCommand.ExecuteScalar ( );
      myConn.Close ( );
      return rowCount;
   }
</script>
</head>

<body>
<!-- #include virtual="~/shared/top.inc" -->
<div class="header"><h2>Custom Paging with AutoIncrement Data Model</h2></div>

<hr size=1 width=92%>

<div align="center">
<form runat="server">
   <table cellpadding=5 width=90%>
   <tr>
      <td><b><asp:label id="lblTracker" runat="server" /></b></td>
      <td align="right">
         <asp:checkbox id="chkNumbers" runat="server"
            title="Mode Property"
            text="Numeric buttons"
            onCheckedChanged="setPagerMode"
            autopostback />
      </td></tr>
   </table>

   <asp:datagrid id="myGrid" runat="server"
      width=98% cellpadding=5 font-size="9pt"
      gridlines="horizontal"
      showheader=false
      autogeneratecolumns=false
      allowpaging allowcustompaging pagesize=5
      onPageIndexChanged="setPage">

      <itemstyle backcolor="ghostwhite" verticalalign="top" />

      <pagerstyle
         position="topandbottom"
         nextpagetext="Next" prevpagetext="Prev"
         backcolor="darkslategray"
         forecolor="khaki"
         font-bold
         horizontalalign="right" />

      <columns>

         <asp:boundcolumn
            datafield="Design" />
         <asp:boundcolumn
            datafield="Model" 
            itemstyle-forecolor="navy"
            itemstyle-font-size="10pt"
            itemstyle-font-bold />
         <asp:boundcolumn
            datafield="Description" />
         <asp:boundcolumn
            datafield="PlanID"
            itemstyle-horizontalalign="right" />

         <asp:templatecolumn>
            <itemtemplate>
               <asp:hyperlink runat="server"
                  navigateurl='<%# Eval ( 
                     "PlanID", "details_plans.aspx?id={0}" ) %>'
                  imageurl='<%# Eval ( 
                     "PlanID", "~/shared/images/plans/thumbs/{0}.jpg" ) %>' 
                  tooltip='<%# Eval ( "Model" ) %>' />
            </itemtemplate>
         </asp:templatecolumn>

      </columns>

   </asp:datagrid>

</form>
</div>

<!-- #include virtual="~/shared/viewsrc.inc" -->

</body>
</html>