dropdownlist的下拉项设成不同的字体样式显示 dropdownlist的下拉项设成不同的字体样式显示比如下拉项显示成这样样式一样式二样式三 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 dropdownlist 基本上是实现不了滴,用层是基本上能实现滴 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]); }看看效果 .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> 样式是从数据库读出来的,用DropDownList1.Items[i].Attributes.Add("style", "样式"]);颜色可以改变,其他的属性没法改变啊 其他的属性用DropDownList1.Items[i].Attributes.Add("style", "样式"])这个样式可以再后面接着写的啊。。样式与样式之间用分号隔开就行 关于jquery表单验证的问题 ASP.NET MVC Seesion 关于在VS2005中使用母版页无法创建内容页 求SQL语句,一列出现相同值的次数 高分求解简单问题,急! 高手请帮助一下:分页显示非绑定的数据怎么做呀? 如何固定treeview的图片大小 怎样定义DataGrid控件的事件? 如何window.showModalDialog 求教:传统的dll和用.net编写的dll之间有什么区别? 用repeater时候怎么控制ItemTemplate的宽度 页面插入图片
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]);
}
看看效果
{
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>
用DropDownList1.Items[i].Attributes.Add("style", "样式"])
这个样式可以再后面接着写的啊。。样式与样式之间用分号隔开就行