Reputation: 2116
I have a user control that loads a asp:dropdownlist via an asp:datasource: What i need to do is show a tooltip on each dropdown value.
Here is my code:
<asp:dropdownlist id="lstBusinessUnit" runat="server"
appenddatabounditems="True"
width="200px"
datasourceid="sqlBusinessUnit"
datatextfield="sBusUnitDisplay"
datavaluefield="sBusUnitCode"
>
<asp:sqldatasource id="sqlBusinessUnit" runat="server"
connectionstring="<%$ ConnectionStrings:Database %>"
selectcommand="SELECT [sBusUnitCode],[sBusUnit], [sBusUnitDisplay] FROM [tBusinessUnits] ORDER BY [sBusUnitDisplay]" />
What i need is for sBunit to be the tooltip for each value. Please help. Thanks.
Upvotes: 0
Views: 87
Reputation: 329
You should add an attribute title to each of your listitem in code behind
foreach (ListItem item in lstBusinessUnit.Items)
{
item.Attributes.Add("Title", "your tooltip");
}
Upvotes: 1