dropdownlist的下拉项设成不同的字体样式显示
比如下拉项显示成这样
样式一
样式二
样式三

解决方案 »

  1.   

    dropdownlist 基本上是实现不了滴,用层是基本上能实现滴
      

  2.   

                    this.DropDownList1.Items.Add(new ListItem("样式一 ", "样式一 "));
                    this.DropDownList1.Items.Add(new ListItem("样式二  ", "样式一 "));
                    this.DropDownList1.Items.Add(new ListItem("样式三", "样式三"));
                    string[] color=new string[]{"black","red","yellow"};
                    for (int i = 0; i < color.Length; i++)
                    {
                        DropDownList1.Items[i].Attributes.Add("style", "color:"+color[i]);
                    }
    看看效果
      

  3.   

    .text
    {
     border-right: #0099cc 1px groove;
     border-top: 1px solid #0099cc;
     font-size: 9pt;
     border-left: 1px solid #0099cc;
     border-bottom: 1px inset #0099cc;
     font-family: 宋体;
     background-color: aliceblue;
    }<asp:DropDownList id="DropDownList1" runat="server" Height="22px" Width="178px" CssClass="text"></asp:DropDownList> 
      

  4.   

    样式是从数据库读出来的,用DropDownList1.Items[i].Attributes.Add("style", "样式"]);颜色可以改变,其他的属性没法改变啊
      

  5.   

    其他的属性
    用DropDownList1.Items[i].Attributes.Add("style", "样式"])
    这个样式可以再后面接着写的啊。。样式与样式之间用分号隔开就行