In ASP.NET, server side controls like listcontrols, dosen't have property for tooltip text. However, you can use the following code sample to show tooltips for ASP.NET controls.
Place the DropDownList or any list control in a <DIV></DIV> tag.
If you like to have a common tool tipe for the entire dropdown list contorl, then set the Title attribute for the DIV control. if you like to have a tool tip for each item in the List, then set the Title for each item in the list:
for(int i=0; i<=DDL.items.count-1; i++) { DDL.Item[i].Attributes.Add("Title", DDL.Item[i].Text) }
|
| Author: mruthunjaya 08 Jan 2008 | Member Level: Bronze Points : 0 |
The code mentioned is not working for Drop down list in VS 2005.
|
| Author: Bharathi 19 May 2008 | Member Level: Diamond Points : 2 |
The code will work with ASP.Net 2.0 as well ASP.Net 1.1. But you may not be able to see the ToolTip text of dropdownlist items in IE 6.0. it Works with higher version of IE.
Thanks.
|