DropdownList


前台: 

<asp:DropDownList ID="Manager" AutoPostBack="true" runat="server" OnSelectedIndexChanged="DropDownList4_SelectedIndexChanged1"></asp:DropDownList>

后台:

 void BindDropDownList4()
    {
        //  DropDownList4.Items.Clear();
        Manager.AppendDataBoundItems = true;
        Manager.Items.Add(new ListItem("经理", "-1"));
        //DropDownList4.Items.Add(new ListItem("请选择一个职位", "-1"));
        Manager.DataTextField = "Name";
        Manager.DataValueField = "id";
        string str = "select id,Name  from Employee";
        Manager.DataSource = DBHelper.GetTable(str);
        Manager.DataBind();

    }

取值:string str=DropDownList4.SelectedValue;


                


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM