Search code examples
asp.netdrop-down-menutooltip

Add tool tip to Asp Drop-down list


When I add a tool tip attribute to asp drop-down list, its not showing any tool tip,When I include this drop-down in the div tag and give title attribute for the div tag, then i can see the tool-tip.

<div title="Professions">
<asp:Dropdownlist runat="server" ID="ddlProfession" DataValueField="ProfessionName" DataTextField="ProfessionName" Width="260px">
</asp:Dropdownlist>
</div>

But I don't want to add any extra div or any other container. directly i want the drop-down to show the tool tip.even it is fine, if you can guide me how to add title attribute for input tag of asp drop-down list which comes after rendering.


Solution

  • It should work:-

    <asp:Dropdownlist runat="server" ID="ddlProfession" DataValueField="ProfessionName"
        DataTextField="ProfessionName" Width="260px" ToolTip="Some Text">
    </asp:Dropdownlist>
    

    Please note it will render Html select with title attribute as Some Text. So you don't need any extra div.