It's easy to set the tooltip on a RadioButtonList control, but what if you want to set a different tooltip for each of the individual radio buttons? (actually ListItems as far as .NET is concerned).
Well its fairly simple, but undocumented, take this example which will set the text of each item to be it's tooltip:
List<string> ds = new List<string>();
ds.Add("Radio 1");
ds.Add("Radio 2");
ds.Add("Radio 3");
RadioButtonList rbList = new RadioButtonList();
rbList.DataSource = ds;
rbList.DataBind();
foreach (ListItem item in rbList.Items)
{
item.Attributes.Add("Title", item.Text);
}
And this approach will work for anything, for example you might want to add an OnClick or mouse over events in the same way.
posted @
Wednesday, June 06, 2007 12:04 PM |
in
C#