This is a simple task to do when we add the Items directly to the dropdown list in the HTML markup. Some time we feel difficulty when we add the Items from the database.
I hope this common method will solve the problem. This common method can be used to add any style to the Items also.
public void AddAttributesToItems(DropDownList ddl)
{
foreach (ListItem item in ddl.Items)
{
if (item.Value != "-1")
{
item.Attributes.Add("title", item.Value);
}
}
}