Hi,
There is different way to apply Tooltip to DropDownList.
You should use .Text
property for tooltip, not for .Value
.
HTML
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<select name="DropDownList1" id="DropDownList1" onmouseover="this.title=this.options[this.selectedIndex].title"
style="width: 119px;">
<option value="1" title="Technical Department">Technical Department</option>
<option value="2" title="Production Department">Production Department</option>
<option value="3" title="HR Department">HR Department</option>
</select>
</div>
</form>
</body>
</html
Demo
using Asp.Net Control
<div>
<asp:DropDownList ID="DropDownList1" runat="server" Width="119px" onmouseover="this.title=this.options[this.selectedIndex].text">
<asp:ListItem Value="1">Technical Department</asp:ListItem>
<asp:ListItem Value="2">Production Department</asp:ListItem>
<asp:ListItem Value="3">HR Department</asp:ListItem>
</asp:DropDownList>
</div>
Or you use code behind
C#
DropDownList1.Attributes.Add("onmouseover", "this.title=this.options[this.selectedIndex].text");
// OR
foreach (ListItem _listItem in this.DropDownList1.Items)
{
_listItem.Attributes.Add("title", _listItem.Text);
}
I hope this will help you out.