コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Params["Page"] == "First")
            {
                ViewState["page"] = 1;
            }
            else if (Request.Params["Page"] == "Last")
            {
                ViewState["page"] = ConfigurationDAL.PageCount();
            }
            else
            {
                ViewState["page"] = Request.Params["Page"] == null ? 1 : 0;
                if ((int)ViewState["page"] == 0)
                {
                    int page = 1;
                    int.TryParse(Request.Params["Page"], out page);
                    ViewState["page"] = page;
                }
            }
            if (!Page.IsPostBack)
            {
                ViewState["pageCount"] = ConfigurationDAL.PageCount();
                if ((int)ViewState["page"] > (int)ViewState["pageCount"] || (int)ViewState["page"] < 0)
                {
                    ViewState["page"] = 1;
                }
                LiteralPage.Text = ViewState["page"] + "/" + ViewState["pageCount"];
            }

            var config = ConfigurationDAL.ConfigurationOnPage((int)ViewState["page"])[0];

            this.FillBoxSetTable(config.boxId);
            this.FillMonitorTable(config.monitorId);
            this.FillPeripheralsTable(config.id);
            this.FillSoftwareTable(config.id);
            LastPageLink.NavigateUrl = @"\WebCompConfigIndex.aspx?page=" + PageCount;
            this.BindPagingRepeater();
        }