Formatting dropdown list

Posted by Vijayar under ASP.NET on 5/10/2011 | Points: 10 | Views : 1055 | Status : [Member] | Replies : 1
Hi
I have a dropdown list,i a m binding values to it from the database.my requirment is i have the change the color of values in dropdown .for this i wrote a loop as
foreach (var item in DropDownList1.Items.Cast<ListItem>().Where(li => li.Value.StartsWith("C", StringComparison.OrdinalIgnoreCase)))
{

item.Attributes.CssStyle.Add("color", "red");

}
but i am not getting any colors the items in dropdown .where should i write this code,whether it should be separate function or after binding data to dropdown.help me in this issue

vijaya


Responses

Posted by: Prabhakar on: 5/10/2011 [Member] [MVP] Starter | Points: 25

Up
0
Down
Hi Vijayar


See these example . . it's help us u . .


http://forums.asp.net/t/1251124.aspx/1

Best Regard's
Prabhakar

Vijayar, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response