protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ViewState["PageCount"] = 0; ViewState["CurrentPage"] = 0; GA Gadmin = new GA(); GAController gadmin = new GAController(); FirstClassDm firstClassName = new FirstClassDm(); firstClassName.FirstClassDmName = "服装鞋帽"; string lfirstClassDmID = Gadmin.FcNameGetID(firstClassName); List <ImgInfo> Furniture = new List <ImgInfo>(); Furniture = gadmin.Furniture(Gadmin, lfirstClassDmID); cblistUpdate.DataSource = Furniture; for (int i = 0; i < Furniture.Count; i++) { cblistUpdate.DataTextField = "ImgTitle"; cblistUpdate.DataValueField = "GoodID"; } cblistUpdate.DataBind(); dlistPictureShow.DataSource = Furniture; dlistPictureShow.DataBind(); if (gadmin.UpdatePictureShow(Gadmin, 2).Count > 1) { drpdownlist.DataSource = gadmin.UpdatePictureShow(Gadmin, 2); drpdownlist.DataTextField = "ImgTitle"; drpdownlist.DataValueField = "GoodID"; drpdownlist.DataBind(); drpdownlist.Items.Insert(0, new ListItem("请选择替换商品")); } int lPageCount = 0; lPageCount = Convert.ToInt32(gadmin.Count(Gadmin, lfirstClassDmID)); mPageCount = lPageCount; info = new string[mPageCount]; if (lPageCount / 10 == 0) { lPageCount = lPageCount / 10; } if (lPageCount / 10 < 1) { lPageCount = 1; } if (lPageCount % 10 > 1) { int lPage = lPageCount % 10; lPageCount = (lPageCount + (10 - lPage)) / 10; } lbPage.Text = "第1页/共 " + lPageCount.ToString() + "页"; ViewState["PageCount"] = lPageCount; if (mPageCount <= 10) { btnUpPage.Enabled = false; btnDownPage.Enabled = false; } else { btnUpPage.Enabled = false; } } }