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;

posted @ 2013-01-17 10:45  心随风若  阅读(422)  评论(0编辑  收藏  举报