protected void Page_Load(object sender, EventArgs e) { Session["Local"] = "工单设定"; if (!IsPostBack) { BomDC bomdc = new BomDC(); DataSet ds = bomdc.getBom_item(); if (ds != null) { DropDownList1.DataSource = ds; DropDownList1.DataTextField = "bom_item_name"; DropDownList1.DataBind(); DropDownList3.DataSource = ds; DropDownList3.DataTextField = "bom_item_name"; DropDownList3.DataBind(); } else { PageUtil.showToast(this.Page, "没有任何bom可供产生工单"); } DropDownList1.Items.Insert(0, "选择大料号"); DropDownList3.Items.Insert(0, "选择大料号"); DropDownList2.Items.Insert(0, "选择版本号"); DropDownList4.Items.Insert(0, "选择版本号"); } }
protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e) { DropDownList4.Items.Clear(); BomDC bomdc = new BomDC(); DataSet ds2 = bomdc.getBomVersion(DropDownList3.Items[DropDownList3.SelectedIndex].Text); int count = ds2.Tables[0].Rows.Count; if (ds2 != null) { DropDownList4.DataSource = ds2.Tables[0].DefaultView; DropDownList4.DataTextField = "bom_version"; DropDownList4.DataBind(); } else { PageUtil.showAlert(this, "版本号载入出错!"); } DropDownList4.Items.Insert(0, "选择版本号"); }