html select 控件

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;

原文地址:https://www.cnblogs.com/LifeKingcn/p/2864066.html