0

我试图从下拉列表中为我需要的列表框选择多个选项,但它应该看起来像一个下拉列表。请告诉我列表框的 CSS 以将其用作下拉列表。

列表框的 CSS

 .setScroll
        {    
                scrollbar-base-color: WhiteSmoke;
                scrollbar-3dlight-color: Blue;
                scrollbar-arrow-color: Red;
                scrollbar-track-color: WhiteSmoke;
                scrollbar-shadow-color: Blue;
                scrollbar-darkshadow-color: WhiteSmoke;
                scrollbar-face-color: WhiteSmoke;
            }

我想选择多个选项,并从文件后面的代码中动态添加此控件

4

1 回答 1

0

标记:

<asp:DropDownList ID="cboItems" runat="server" />

后面的代码:

List<ListItem> items = new List<ListItem>();
for (int i = 1; i < 11; i++)
{
    ListItem item = new ListItem();
    item.Text = string.Format("this is a very very long item text corresponding to the  number {0}", i);
    item.Value = i.ToString();
    items.Add(item);
}
cboItems.DataSource = items;
cboItems.DataBind();
// after data bind is complete
cboItems.Attributes["style"] = "width: 100px; max-width: 100px";
于 2013-10-30T05:25:37.623 回答