Home | Articles|Namespace|Interview Questions|Tools|Jobs|Projects|Community
Asp.net Tutorials

»Dotnet Ads
»Message Boards
Message Boards
Dotnet Books

»Member Details
Register
Login
LogOut
Submit Code
Submit Jobs
Submit Projects

»Competition
Community
Winners
Prizes
Write For Us
Members

»Other Resources
Links
Dotnet Resources


Forums»ASP.NET Forums»



Dropdownlist Box colors

How can i change the color of the items in a dropdownlist box ?
posted by:anonymous on 12/2/2007 9:30:14 PM
Color Full Dropdown Box


Add this line of code between <form >...

<asp:DropDownList runat="server" ID="ddlTest" ForeColor=green>
<asp:ListItem Text="select1" Value="select1" ></asp:ListItem>
<asp:ListItem Text="select2" Value="select2" ></asp:ListItem>
<asp:ListItem Text="select3" Value="select3" ></asp:ListItem>
<asp:ListItem Text="select4" Value="select4" ></asp:ListItem>
<asp:ListItem Text="select5" Value="select5" ></asp:ListItem>
</asp:DropDownList>


Code Behind on Page Load

protected void Page_Load(object sender, EventArgs e)
{

ddlTest.Items[0].Attributes.Add("style", "background-color:blue;color:yellow");
ddlTest.Items[1].Attributes.Add("style", "background-color:yellow;color:Red");

}

Rajendra Prasad Kuldeep
posted by:Rajendra  on 12/3/2007 12:55:25 AM
© 2008 dotnetwatch.com -- Privacy policy

Website Design & Internet Marketing by Shivam