This blog is moved to

Wednesday, November 11, 2009

ASP.Net Dropdown List and Tooltip

In some cases the dropdown list will be having large text. And the size of dropdown list is small. In such cases the item won’t be visible to the end user. One option is to expand the dropdown list. But if the size of text is large then it won’t look good in UI. One workaround is to place the item as tooltip. For achieving this you can use the following code.

DropDownList1.Items[0].Attributes.Add("Title", "Some1");
DropDownList1.Items[1].Attributes.Add("Title", "Some2");
DropDownList1.Items[2].Attributes.Add("Title", "Some3");
The title attribute will just add the provided value as the tooltip.
Hope this helps.

No comments: