Show tooltip when selecting element asp: DropDownList

I have an asp: DropDownList on a page that, due to the 1024x768 design standard, may truncate some text values ​​in the dropdown (not enough, apparently, to reverse engineer the layout), so I need to display a hint of the selected value when the dropdown is selected (i.e. i.e. when the dropdown is displayed and the element hovers), preferably only when the text for that element is truncated.

Is this possible by default, javascript hack, or just my imagination?

+1


source to share


3 answers


foreach (ListItem _listItem in this.DropDownList1.Items)    
{     
  _listItem.Attributes.Add("title", _listItem.Text); 

}

      

// add a tooltip for the selected item.



DropDownList1.Attributes.Add("onmouseover", this.title=this.options[this.selectedIndex].title");

      

+3


source


Add a Title attribute to your list items with your tooltip information. This is not an existing item in intellisense, but it should work. This is happening on my system. Now I'm not really sure how to do this if you are DataBinding the dropdown to the data source. But if you are hard-coding in ASPX or in code then how can you do it.



<asp:DropDownList id="ddl1" runat="server">
  <asp:ListItem Text="Display text" Value="1" Title="This is my tooltip"></asp:ListItem>
</asp:DropDownList>

      

0


source


You can also post back and upload data to the help icon. boxover works really well.

0


source







All Articles