Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Feb 05, 2012 02:54 PM by MetalAsp.Net
Feb 05, 2012 09:32 AM|LINK
Is it possible to have different background colors in the dropdownlist? One color for main categories and another color for subcategories..
I would be very happy if someone could tell me how its done, and were to put the code :)
I also want to change the listing order of the categories, I dont want to have from A-Z, I want to change it manually if its possible...
Thanx in advance!
Feb 05, 2012 09:59 AM|LINK
It really depends on how you're populating the DDL. You need to explain more. But here's how you can set the color for one item: DropDownList1.Items.Attributes.Add("style", "background-color: red");
Feb 05, 2012 10:29 AM|LINK
Hey thanx for your answer!
But where should I put DropDownList1.Items.Attributes.Add("style", "background-color: red"); ? In CategoryDropDown.ascx?
If I put it this way, I want the background of all the MAIN categories in the dropdownlist to be light blue... Thats all I want to do. :)
How do I achieve that? I use Asp.Net VB by the way...
Feb 05, 2012 02:54 PM|LINK
Oh sorry. I just noticed your question is in a starter kit forum. I don't know anything about the classifieds starter kit. I was just giving a general webforms asnwer where you can iterate through a DDLs Items collection and set the style as I described
to change the color.