August 10, 2009

Setting title of web controls

In this article, I will show how to create tooltip for web controls. For most controls, the Tooltip property can be used to set the tooltip. For controls that do not support Tooltip property, the title attribute can be set. For DropDownList. RadioButtonList, CheckBoxList and BulletedList, tooltip is set for the control and for each item in the control.


Craig Lambie said...

Ok, so how do I set the Title attribute on a RadioButtonList from a Database entry?

ie. set .Title = "FieldFromDb"

Can I see the source code?


Shahed Kazi said...

You can add the title attribute to each item of the RadioButtonList like below.

RadioButtonList rl = new RadioButtonList();
foreach (ListItem li in rl.Items)
{ li.Attributes.Add("title", "title of this item");

Reference: Shahed Kazi at