protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) { lblMsg.Text = "Selected id=" + GridView1.SelectedRow.Cells[1].Text; //关键,必须为主键控件赋值 this.dlCHJLH.Text = GridView1.SelectedRow.Cells[1].Text; //填充数据 MyWebForm.Instance.AutoSelectIBForm(this.Controls); //设置下拉框的选项 //得到当前条码号 string sn = this.dtbSN.Text; GoodsManageBIZ biz = new GoodsManageBIZ(); GoodsBaseInfo info = biz.GetGoodsBaseInfo(sn); this.ddlGoodsNames.Text = info.GoodsName; List<GoodsBaseInfoVM> list = biz.GetGoodsBaseInfoWhithGoodsName(info.GoodsName); this.ddlManufacturer.DataTextField = "Manufacturer"; this.ddlManufacturer.DataValueField = "SerialNumber"; this.ddlManufacturer.DataSource = list; this.ddlManufacturer.DataBind(); this.ddlManufacturer.SelectedValue = sn; }
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) { lblMsg.Text = "Selected id=" + GridView1.SelectedRow.Cells[1].Text; string sn = GridView1.SelectedRow.Cells[1].Text; //调用业务层方法获取实体 GoodsManageBIZ biz = new GoodsManageBIZ(); GoodsBaseInfo info=biz.GetGoodsBaseInfo(sn); //将实体与页面控件绑定 WebControlDataMap.FillDataFromEntityClass(info, MyWebForm.GetIBControls(this.tbGoosBaseInfo.Controls) ); }