FineUI 官方论坛

标题: dropdownlist多选的问题 [打印本页]

作者: jiangsushisi    时间: 2014-10-9 16:50
标题: dropdownlist多选的问题
前台代码:
<form id="form1" runat="server">
    <f:pagemanager id="ageManager1" runat="server" />
    <fropDownList ID="drop1" runat="server" Label="Label"  AutoPostBack="true" EnableMultiSelect="true" >
    </fropDownList>
   <fropDownList ID="ddlEJBCL" runat="server" AutoPostBack="true" EnableMultiSelect="true" Width="120px">
    </fropDownList>
    <f:Button ID="Button1" runat="server" Text="Button">
    </f:Button>
    </form>
后台代码:
protected void Page_Load(object sender, EventArgs e)
    {
        ddlEJBCL.Items.Clear();
        FineUI.ListItem list = new FineUI.ListItem();
        list.Text = "a";
        list.Value = "a";
        FineUI.ListItem list1 = new FineUI.ListItem();
        list1.Text = "b";
        list1.Value = "b";
        FineUI.ListItem list2 = new FineUI.ListItem();
        list2.Text = "c";
        list2.Value = "c";

        ddlEJBCL.Items.Add(list);
        ddlEJBCL.Items.Add(list1);
        ddlEJBCL.Items.Add(list2);

        string[] ss = new string[] { "a", "b", "c" };
        foreach (string s in ss)
        {
            ddlEJBCL.Items.FindByText(s).Selected = true;
        }
}

protected void Button1_Click(object sender, EventArgs e)
    {
        drop1.Items.Clear();
        FineUI.ListItem list = new FineUI.ListItem();
        list.Text = "a";
        list.Value = "a";
        FineUI.ListItem list1 = new FineUI.ListItem();
        list1.Text = "b";
        list1.Value = "b";
        FineUI.ListItem list2 = new FineUI.ListItem();
        list2.Text = "c";
        list2.Value = "c";

        drop1.Items.Add(list);
        drop1.Items.Add(list1);
        drop1.Items.Add(list2);

        string[] ss = new string[] { "a", "b", "c" };
        foreach (string s in ss)
        {
            drop1.Items.FindByText(s).Selected = true;
        }
    }

dropdownlist在Page_Load里能够实现多个选中,在Button1_Click里不能实现多个选中,只能显示一个选中













欢迎光临 FineUI 官方论坛 (https://fineui.com/BBS/) Powered by Discuz! X3.4