/// <summary> /// 二级联动职位 /// </summary> private void position() { string deptno = DropDownList1.SelectedValue; if (deptno != "-1") { List <CustomClass> myList2 = new List <CustomClass>(); Demo.BLL.tb_JC_Position bll = new Demo.BLL.tb_JC_Position(); List <Demo.Model.tb_JC_Position> model = new List <Demo.Model.tb_JC_Position>(); //联动 model = bll.GetModelList("DepartmentNO = '" + deptno + "'"); foreach (Demo.Model.tb_JC_Position temp in model) { myList2.Add(new CustomClass(temp.PositionNO, temp.PositionName)); } DropDownList2.DataTextField = "Name"; DropDownList2.DataValueField = "ID"; DropDownList2.DataSource = myList2; DropDownList2.DataBind(); } DropDownList2.Items.Insert(0, new ListItem("请选择职位", "-1")); DropDownList2.SelectedValue = "-1"; // 是否禁用 DropDownList2.Enabled = !(DropDownList1.Items.Count == 1); }
protected void ttbSearch2_Trigger2Click(object sender, EventArgs e) { //search Demo.BLL.tb_JC_Position bll = new Demo.BLL.tb_JC_Position(); Demo.Model.tb_JC_Position model = new Demo.Model.tb_JC_Position(); string posiname = ttbSearch2.Text.Trim(); if (bll.GetModelList("PositionName = '" + posiname + "'").Count == 0) { Alert.ShowInTop("未找到该职位!"); } else { model = bll.GetModelList("PositionName = '" + posiname + "'")[0]; PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("~/Web/JC/deptment/listpositionmodify.aspx?id={0}&PositionNO={1}", model.ID, model.PositionNO), "编辑")); } }