页面代码:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="list.aspx.cs" Inherits="list" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>建委审批项目清单</title>
<link href="style.css" rel="stylesheet" type="text/css" /></head>
<body>
<span class="time" id="time"">
<script type="text/javascript">ShowDate(time)</script>
</span> <span class="time" id="time2">
<script type="text/javascript">ShowTime(time2)</script>
</span> <a href="Default.aspx">返回到Default.aspx</a>
<form id="form1" runat="server">
  <div>
    <asp:Label ID="Label1" runat="server" Text="请输入建设单位名称:       " ForeColor="Blue"></asp:Label>
    &nbsp;&nbsp;&nbsp;&nbsp;
    <asp:TextBox ID="Search_txt" runat="server" Width="264px" EnableViewState="False"></asp:TextBox>
    <asp:Button ID="Search" runat="server" Text="搜索"  EnableViewState="False" />
    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="Search_txt"
            ErrorMessage="搜索信息不能为空" Font-Size="Smaller"></asp:RequiredFieldValidator>
    <br />
    <asp:Label ID="PagingInformation" runat="server" Font-Size="Smaller" ForeColor="DarkGoldenrod"></asp:Label>
    <br />
    <asp:GridView ID="GridView1" runat="server" CellPadding="3" 
    HorizontalAlign="Center" Width="980px" AutoGenerateColumns="False" 
    Font-Size="Smaller" 
    PageSize="5" BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" 
    BorderWidth="1px" CssClass="tb_Inner" 
    EmptyDataText="<center>没有搜索到任何记录,请重置搜索条件。</center>" ForeColor="Red"
    EnableViewState="False" AllowPaging="True" OnDataBound="GridView1_DataBound" >
      <FooterStyle BackColor="White" ForeColor="#000066" />
      <RowStyle HorizontalAlign="Center" ForeColor="Blue" />
      <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
      <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Center" Font-Size="Small" />
      <HeaderStyle BackColor="DodgerBlue" Font-Bold="True" ForeColor="White" />
      <Columns>
      <asp:BoundField HeaderText="序号" />
      <asp:BoundField DataField="审批事项名称" SortExpression="审批事项名称" HeaderText="审批事项名称" />
      <asp:BoundField DataField="通知书文号" SortExpression="通知书文号" HeaderText="通知书文号" />
      <asp:BoundField DataField="许可证号" SortExpression="许可证号" HeaderText="许可证号" />
      <asp:BoundField DataField="建设单位名称" SortExpression="建设单位名称" HeaderText="建设单位名称" />
      <asp:BoundField DataField="项目名称" SortExpression="项目名称" HeaderText="项目名称" />
      <asp:BoundField DataField="发证日期" SortExpression="发证日期" DataFormatString="{0:yyyy.MM.dd}" HeaderText="发证日期" HtmlEncode="False" />
      </Columns>
      <AlternatingRowStyle BackColor="Info" />
      
      <pagertemplate>
          <table width="100%">
               <tr>
                  <td style="text-align:right">
                  第<asp:Label id="lblPageIndex" runat="server" text='<%# ((GridView)Container.Parent.Parent).PageIndex + 1  %>' />页
                  共/<asp:Label id="lblPageCount" runat="server" text='<%# ((GridView)Container.Parent.Parent).PageCount  %>' />页 
                  <asp:linkbutton id="btnFirst" runat="server" causesvalidation="False" commandargument="First" CommandName="Pager" text="首页" OnCommand="NavigateToPage" />
                  <asp:linkbutton id="btnPrev" runat="server" causesvalidation="False" commandargument="Prev" CommandName="Pager"  text="上一页" OnCommand="NavigateToPage" />
                  <asp:linkbutton id="btnNext" runat="server" causesvalidation="False" commandargument="Next" CommandName="Pager" text="下一页" OnCommand="NavigateToPage" />                          
                  <asp:linkbutton id="btnLast" runat="server" causesvalidation="False" commandargument="Last" CommandName="Pager" text="尾页" OnCommand="NavigateToPage" />                                            
                  <asp:textbox id="txtNewPageIndex" runat="server" width="20px" text='<%# ((GridView)Container.Parent.Parent).PageIndex + 1  %>' />
                  <asp:linkbutton id="btnGo" runat="server" causesvalidation="False" commandargument="-1" commandname="Page" text="GO" /><!-- here set the CommandArgument of the Go Button to '-1' as the flag -->
                  </td>
                </tr>
           </table>
      </pagertemplate>           
    </asp:GridView>
    &nbsp; </div>
    
    
</form></body>
</html>类代码:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;public partial class list : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        
        if (!IsPostBack )
        {
            GridViewFill();            
        }
    }
    
    protected void NavigateToPage(object sender, CommandEventArgs e)
    {
        //控制转页
        switch (e.CommandArgument.ToString())
        {
            case "First":
                this.GridView1.PageIndex = 0;
                break;
            case "Prev":
                if (this.GridView1.PageIndex > 0)
                    this.GridView1.PageIndex -= 1;
                break;
            case "Next":
                if (this.GridView1.PageIndex < (this.GridView1.PageCount - 1))
                    this.GridView1.PageIndex += 1;
                break;
            case "Last":
                this.GridView1.PageIndex = this.GridView1.PageCount - 1;
                break;
        }
        GridViewFill();
    }    private void GridViewFill()
    {        string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data source=" + Server.MapPath(@"App_Data\permit .mdb");
        OleDbConnection conn=new OleDbConnection(strConn);
        DataSet ds = new DataSet();
        
        string strSql = "SELECT * FROM [notice] ORDER BY [发证日期] DESC , [许可证号] ";        OleDbDataAdapter oAdapter = new OleDbDataAdapter(strSql, conn);        oAdapter.Fill(ds,"notice");        this.GridView1.DataSource = ds.Tables["notice"];
        this.GridView1.DataBind();    }
    protected void GridView1_DataBound(object sender, EventArgs e)
    {
        GridViewRow pagerRow = GridView1.BottomPagerRow;        LinkButton btnFirstTem = (LinkButton)pagerRow.Cells[0].FindControl("btnFirst");
        LinkButton btnPrevTem = (LinkButton)pagerRow.Cells[0].FindControl("btnPrev");
        LinkButton btnNextTem = (LinkButton)pagerRow.Cells[0].FindControl("btnNext");
        LinkButton btnLastTem = (LinkButton)pagerRow.Cells[0].FindControl("btnLast");
        if (this.GridView1.PageIndex == 0)
        {
            btnFirstTem.Enabled = false;
            btnPrevTem.Enabled = false;
           
            if (this.GridView1.PageCount == 1)
            {
                btnNextTem.Enabled = false;
                btnLastTem.Enabled = false;
            }
        }
        else if (this.GridView1.PageIndex == (this.GridView1.PageCount - 1))
        {
            btnNextTem.Enabled = false;
            btnLastTem.Enabled = false;
        }
    }}点击下一页后,并没有调用NavigateToPage(object sender, CommandEventArgs e),很急.谢谢大家了!!