protected void Page_Load(object sender, EventArgs e) { string _action = DTRequest.GetQueryString("action"); BLL.user_deptbll bll = new BLL.user_deptbll(); DataTable tb = bll.GetList(1000, " 1=1 ", " id").Tables[0]; this.ddlDept_Code.Items.Clear(); foreach (DataRow dr in tb.Rows) { this.ddlDept_Code.Items.Add(new ListItem(dr["Dept_Name"].ToString(), dr["Dept_Code"].ToString())); } if (!string.IsNullOrEmpty(_action) && _action == DTEnums.ActionEnum.Edit.ToString()) { this.action = DTEnums.ActionEnum.Edit.ToString();//修改类型 this.id = DTRequest.GetQueryInt("id"); if (this.id == 0) { JscriptMsg("传输参数不正确!", "back", "Error"); return; } if (!new BLL.car_driverbll().Exists(this.id)) { JscriptMsg("信息不存在或已被删除!", "back", "Error"); return; } } if (!Page.IsPostBack) { if (action == DTEnums.ActionEnum.Edit.ToString()) //修改 { ShowInfo(this.id); } } }
private void BindDept_Code(string strwhere) { BLL.user_deptbll bll = new BLL.user_deptbll(); DataTable tb = bll.GetList(1000, strwhere, " id").Tables[0]; this.ddlDept_Code.Items.Clear(); this.ddlDept_Code.Items.Add(new ListItem("请选择部门...", "")); foreach (DataRow dr in tb.Rows) { this.ddlDept_Code.Items.Add(new ListItem(dr["Dept_Name"].ToString(), dr["Dept_Code"].ToString())); } }