1.前台
<select runat="server" id="selBranch" autowidth="true"></select>
<select runat="server" id="selLock" autowidth="true"> <option value="" selected="selected">是否禁用...</option> <option value="正常">正常</option> <option value="禁用">禁用</option> </select>
2.后台
数据绑定:
fcwms.BLL.dt_branch bll = new fcwms.BLL.dt_branch(); DataTable dt = bll.GetList("").Tables[0]; this.selBranch.Items.Clear(); this.selBranch.Items.Add(new ListItem("请选择部门...", "")); foreach (DataRow dr in dt.Rows) { this.selBranch.Items.Add(new ListItem(dr["branch_name"].ToString(), dr["id"].ToString())); }
获取选中值: string a = this.selBranch.value;