if (ddlcountry.Items[0].Text == "India") { ddlCountry.BackColor = System.Drawing.Color.Blue; }
Best Regard's Prabhakar
vijaya
DropDownList1.Attributes.Add("style", "font-weight:bold");
Mark this as answer, if it is..... With regards Nishithraj Narayanan
private void UpdateDdlColor() { var count = (from objlst in ddlMediator.Items.Cast<ListItem>() select Changecolor(objlst, UsersList)).Count(); } private bool Changecolor(ListItem objlst, List<EntyInfo> UsersList) { string strcolorName = (from objUserlst in UsersList where objUserlst.UserId == Convert.ToInt64(objlst.Value) select objUserlst.ColorName).FirstOrDefault(); objlst.Attributes.Add("style", string.Format("color:{0}", strcolorName)); return true; }
Bhaarat http://ransandeep.blogspot.com
foreach (ListItem item in DropDownList1.Items) { //if you want to apply for some selected items check the condition on item.Text or item.Value based on your requirement. if (item.Text == "Some Value") { //Change font weight item.Attributes.CssStyle.Add("font-weight", "bold"); //Change font color item.Attributes.CssStyle.Add("color", "red"); } } * Please note that font-weight and font-size is not rendered properly in IE, you can see the difference in Firefox etc. So try to use the color property to distinguish. Thanks, DebataVijayar, if this helps please login to Mark As Answer. | Alert Moderator
* Please note that font-weight and font-size is not rendered properly in IE, you can see the difference in Firefox etc. So try to use the color property to distinguish. Thanks, DebataVijayar, if this helps please login to Mark As Answer. | Alert Moderator
Login to post response