AspNetPager.dll分頁控件綁定gridview,datalist,repeater

 public class AspPager
    {
        public static void AspNetPager(GridView gv, DataSet ds, Wuqi.Webdiyer.AspNetPager asppager, string where)
        {
            DataView dv = new DataView(ds.Tables[0]);
            dv.RowFilter = where;
            asppager.RecordCount = dv.Count;
            PagedDataSource pds = new PagedDataSource();
            pds.DataSource = dv;
            pds.AllowPaging = true;
            pds.CurrentPageIndex = asppager.CurrentPageIndex - 1;
            pds.PageSize = asppager.PageSize;
            gv.DataSource = pds;
            gv.DataBind();
        }

        public static void AspNetPager(DataList dl, DataSet ds, Wuqi.Webdiyer.AspNetPager asppager, string where)
        {
            DataView dv = new DataView(ds.Tables[0]);
            dv.RowFilter = where;
            asppager.RecordCount = dv.Count;
            PagedDataSource pds = new PagedDataSource();
            pds.DataSource = dv;
            pds.AllowPaging = true;
            pds.CurrentPageIndex = asppager.CurrentPageIndex - 1;
            pds.PageSize = asppager.PageSize;
            dl.DataSource = pds;
            dl.DataBind();
        }


        public static void AspNetPager(Repeater dl, DataSet ds, Wuqi.Webdiyer.AspNetPager asppager, string where)
        {
            DataView dv = new DataView(ds.Tables[0]);
            dv.RowFilter = where;
            asppager.RecordCount = dv.Count;
            PagedDataSource pds = new PagedDataSource();
            pds.DataSource = dv;
            pds.AllowPaging = true;
            pds.CurrentPageIndex = asppager.CurrentPageIndex - 1;
            pds.PageSize = asppager.PageSize;
            dl.DataSource = pds;
            dl.DataBind();
        }
    }

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章