none
怎么在DropDownList绑定数据时再添加一个数值 RRS feed

  • 问题

  • 我显示部门的时候我想默认的是全部部门,员工下拉框默认显示全部员工。选择个别部门,员工下拉框默认显示的也是原本员工
    <table border="0" cellpadding="0" cellspacing="2" style="width:100%" align="left">
               <tr>
           <td align="right">
              部门
             </td>
             <td align="left">
                 <asp:DropDownList ID="Department" runat="server" OnSelectedIndexChanged="Department_SelectedIndexChanged">
                 </asp:DropDownList></td>
             <td align="right">
              员工   
             </td>
             <td align="left">
                 <asp:DropDownList ID="PersonM" runat="server">
                 </asp:DropDownList>
             </td>
               </tr>
          </table>

    部门源码显示
            Department.DataSource = Bll.Department.GetDepartment(CompanyID);
            Department.DataTextField = "Branch_TypeTitle";
            Department.DataValueField = "Branch_TypeID";
            Department.DataBind();
            Department.Dispose();

    可以在DataBind前添加DePartment.Item.add("0","全部部门")吗?
    2009年11月2日 2:32

答案

全部回复