protected void Page_Load(object sender, EventArgs e)
    {
        Server.Execute("pub.aspx");//注释掉就可以分页
        if (!IsPostBack)
        {
            this.bindtoDataGrid();
        }
       
    }
    protected void bindtoDataGrid()
    {
        SqlConnection con = DB.CreateConnection();
        SqlDataAdapter sda = new SqlDataAdapter();
        sda.SelectCommand = new SqlCommand("select a.*,(select isnull(sum(b.adcount),0) from AD800_DETAIL b where b.adid=a.id) as tcount from AD800_AD a  ORDER BY a.begintime desc", con);
        DataSet ds = new DataSet();
        sda.Fill(ds, "emp");
        this.gvGG.DataSource = ds.Tables["emp"];
        this.gvGG.DataBind();
    }
    protected void gvGG_PageIndexChanged(object source, DataGridPageChangedEventArgs e)
    {
        this.gvGG.CurrentPageIndex = e.NewPageIndex;
        this.bindtoDataGrid();
    }各位大虾我为什么用Server.Execute("pub.aspx"); gridview 就无法分页