绑定数据

protected void databind()
    {
        string sqlstr = "";
        SqlParameter[] par = new SqlParameter[]
        {
         
        };
        PagedDataSource pds = new PagedDataSource();
        pds.DataSource=dbhelp.GetDataSet(sqlstr,par).DefaultView;
        this.AspNetPager1.RecordCount=pds.Count;
        pds.AllowPaging = true;
        pds.PageSize = this.AspNetPager1.PageSize;
        pds.CurrentPageIndex = this.AspNetPager1.CurrentPageIndex - 1;
        this.GridView1.DataSource= pds;
        this.GridView1.DataBind();
    }

原文地址:https://www.cnblogs.com/weiwin/p/2717934.html