private void Page_Load(object sender, System.EventArgs e) { // 在此处放置用户代码以初始化页面 this.ClientScript.RegisterStartupScript(this.GetType(), "hide", "<script lanaguage=javascript>ShowHide('1','none');</script>"); if (Session["Login"] != null) { CMSMStruct.LoginStruct ls1 = (CMSMStruct.LoginStruct)Session["Login"]; if (!IsPostBack) { this.btnSave.Enabled = false; this.txtGoodsCode.Enabled = false; this.txtGoodsName.Enabled = false; this.txtStockUnit.Enabled = false; Session.Remove("QUERY"); Session.Remove("page_view"); this.ddlInvalidFlag.Items.Add(new ListItem("有效", "1")); this.ddlInvalidFlag.Items.Add(new ListItem("无效", "0")); this.ddlInvalidFlag.SelectedIndex = 0; string strPVid = Request.QueryString["pid"]; string strPVname = Request.QueryString["pname"]; string strGoodsCode = Request.QueryString["gid"]; if (strPVid == null || strPVid == "" || strPVname == null || strPVname == "") { this.txtProviderID.Text = ""; this.txtProviderName.Text = ""; this.btnAdd.Enabled = false; this.ddlInvalidFlag.Enabled = false; this.Button1.Enabled = false; } else { if (strGoodsCode == null || strGoodsCode == "") { this.txtProviderID.Text = strPVid.Trim(); this.txtProviderName.Text = strPVname.Trim(); this.btnAdd.Enabled = true; this.ddlInvalidFlag.Enabled = false; } else { this.txtProviderID.Text = strPVid.Trim(); this.txtProviderName.Text = strPVname.Trim(); this.txtGoodsCode.Text = strGoodsCode.Trim(); this.btnAdd.Enabled = false; this.btnSave.Enabled = true; this.txtGoodsCode.Enabled = false; this.txtGoodsName.Enabled = false; this.ddlInvalidFlag.Enabled = true; Hashtable htapp = (Hashtable)Application["appconf"]; string strcons = (string)htapp["cons"]; StoBusi = new BusiComm.StorageBusi(strcons); CMSMStruct.ProviderStockStruct pss = StoBusi.GetProvStockOne(strPVid.Trim(), strGoodsCode.Trim()); this.txtStockUnit.Text = pss.strGoodsUnit; this.txtStockPrice.Text = pss.dGoodsPrice.ToString(); this.ddlInvalidFlag.SelectedIndex = this.ddlInvalidFlag.Items.IndexOf(this.ddlInvalidFlag.Items.FindByValue(pss.strInvalidFlag)); this.txtGoodsName.Text = pss.strGoodsName; this.txtProducer.Text = pss.strProducer; } this.dgbind(); } } } else { Response.Redirect("../Exit.aspx"); } }