public void RptBind() { string strWhere = ""; if (Session["strWhereProduct"] != null && Session["strWhereProduct"].ToString() != "") { strWhere += Session["strWhereProduct"].ToString(); } Cms.DAL.ProductInfo dal = new Cms.DAL.ProductInfo(); DataSet ds = dal.GetProductList(strWhere); DataView dv = ds.Tables[0].DefaultView; //利用PAGEDDAGASOURCE类来分页 PagedDataSource pds = new PagedDataSource(); AspNetPager1.RecordCount = dv.Count; pcount = dv.Count; pds.DataSource = dv; pds.AllowPaging = true; pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1; pds.PageSize = AspNetPager1.PageSize; //获得总条数 pcount = dv.Count; //绑定数据 rptList.DataSource = pds; rptList.DataBind(); }
public int pcount = 0; //总条数 #endregion Fields #region Methods public void RptBind() { string strWhere = ""; if (Session["strWhereProduct"] != null && Session["strWhereProduct"].ToString() != "") { strWhere += Session["strWhereProduct"].ToString(); } Cms.DAL.ProductInfo dal = new Cms.DAL.ProductInfo(); DataSet ds = dal.GetProductList(strWhere); DataView dv = ds.Tables[0].DefaultView; //利用PAGEDDAGASOURCE类来分页 PagedDataSource pds = new PagedDataSource(); AspNetPager1.RecordCount = dv.Count; pcount = dv.Count; pds.DataSource = dv; pds.AllowPaging = true; pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1; pds.PageSize = AspNetPager1.PageSize; //获得总条数 pcount = dv.Count; //绑定数据 rptList.DataSource = pds; rptList.DataBind(); }
private void RptBind(string strWhere) { Cms.DAL.ProductInfo dal = new Cms.DAL.ProductInfo(); DataSet ds = dal.GetProductList(strWhere); DataView dv = ds.Tables[0].DefaultView; //利用PAGEDDAGASOURCE类来分页 PagedDataSource pds = new PagedDataSource(); AspNetPager1.RecordCount = dv.Count; pds.DataSource = dv; pds.AllowPaging = true; pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1; pds.PageSize = AspNetPager1.PageSize; //获得总条数 pcount = dv.Count; if (this.pcount < 0) { this.lbmsg.Visible = true; this.lbmsg.Text = "暂时没有产品"; } //绑定数据 rptList.DataSource = pds; rptList.DataBind(); }
private void RptBind(string strWhere) { Cms.DAL.ProductInfo dal = new Cms.DAL.ProductInfo(); DataSet ds = dal.GetProductList(strWhere); DataView dv = ds.Tables[0].DefaultView; //利用PAGEDDAGASOURCE类来分页 PagedDataSource pds = new PagedDataSource(); AspNetPager1.RecordCount = dv.Count; pds.DataSource = dv; pds.AllowPaging = true; pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1; pds.PageSize = AspNetPager1.PageSize; //获得总条数 pcount = dv.Count; if (this.pcount < 0) { this.lbmsg.Visible = true; this.lbmsg.Text = "暂时没有产品"; } //绑定数据 rptList.DataSource = pds; rptList.DataBind(); }