protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ViewState["surrentPage"] = 0; OA mOA = new OA(); int PageSum = mOA.GetPages(); ShowPages.Text = "第" + (Convert.ToInt32(ViewState["surrentPage"]) + 1).ToString() + "页/共" + PageSum + "页"; divide mdv = new divide(); this.OrderList.DataSource = mdv.OrderShow(Convert.ToInt32(ViewState["surrentPage"])); this.OrderList.DataBind(); } }
/// <summary> /// 上一页 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void last_Click(object sender, EventArgs e) { if (Convert.ToInt32(ViewState["surrentPage"]) > 0) { ViewState["surrentPage"] = Convert.ToInt32(ViewState["surrentPage"]) - 1; divide mdv = new divide(); this.OrderList.DataSource = mdv.OrderShow(Convert.ToInt32(ViewState["surrentPage"])); this.OrderList.DataBind(); } else { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('" + "已经是第一页!!" + "');</script> "); } OA mOA = new OA(); int PageSum = mOA.GetPages(); ShowPages.Text = "第" + (Convert.ToInt32(ViewState["surrentPage"]) + 1).ToString() + "页/共" + PageSum + "页"; }