protected void Page_Load(object sender, EventArgs e) { string mDate = Session["HandleDay"].ToString(); //第一次加载显示第一页 if (!IsPostBack) { ViewState["surrentPage"] = 1; DayBookList.DataSource = mDivide.DayBookDateShow(Convert.ToInt32(ViewState["surrentPage"]), mDate); DayBookList.DataBind(); } }
//下一页 protected void next_Click(object sender, EventArgs e) { string mDate = Session["HandleDay"].ToString(); int gPageSum = mDivide.PageSumDayBookDate(mDate); //总共页数 if (Convert.ToInt32(ViewState["surrentPage"]) < gPageSum) { DayBookList.DataSource = mDivide.DayBookDateShow(Convert.ToInt32(ViewState["surrentPage"]), mDate); DayBookList.DataBind(); ViewState["surrentPage"] = Convert.ToInt32(ViewState["surrentPage"]) + 1; } else { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('" + "已经是最后一页!" + "');</script> "); } }
//下一页 protected void next_Click(object sender, EventArgs e) { int gPageSum = mDivide.PageSumDayBook(); //总共页数 if (Convert.ToInt32(ViewState["surrentPage"]) < (gPageSum)) { DayBookList.DataSource = mDivide.DayBookShow(Convert.ToInt32(ViewState["surrentPage"])); DayBookList.DataBind(); ViewState["surrentPage"] = Convert.ToInt32(ViewState["surrentPage"]) + 1; } else { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('" + "已经是最后一页!" + "');</script> "); } int CurrentPage = Convert.ToInt32(ViewState["surrentPage"]); int PageSum = mDayBook.GetPages(); ShowPages.Text = "第" + (CurrentPage).ToString() + "页/共" + PageSum + "页"; }
protected void Page_Load(object sender, EventArgs e) { //第一次加载显示第一页 if (!IsPostBack) { //lPageIndex = 0; ViewState["surrentPage"] = 0; int CurrentPage = Convert.ToInt32(ViewState["surrentPage"]); int PageSum = mDayBook.GetPages(); ShowPages.Text = "第" + (CurrentPage + 1).ToString() + "页/共" + PageSum + "页"; DayBookList.DataSource = mDivide.DayBookShow(Convert.ToInt32(ViewState["surrentPage"])); DayBookList.DataBind(); ViewState["surrentPage"] = Convert.ToInt32(ViewState["surrentPage"]) + 1; } //DayBookList.DataSource = mDivide.DayBookShow(lPageIndex); //DayBookList.DataBind(); //lPageIndex++; }