Solved

ToolTip in ASP.Net For Dropdown Control

Posted on 2004-08-31
2
871 Views
Last Modified: 2008-01-09
Hi All,

I need to create a ToolTip for a DropDown Control in ASP.Net.  I know there's a way to do this.  The DropDown control in ASP.Net does not have a ToolTip property, so I need to create one.  I don't want to insert JavaScript.  I'd prefer to do this in VB.Net code for the ASP.Net page.

I'm aware that the ToolTip control is a part of System.ComponentModel.Component on the VB Windows side, but I can't figure out how to add the ToolTip property to the DropDown control for an ASP.Net DropDown control.

Does anyone know how to do this for an ASP.Net DropDown control?

Thanks

0
Comment
Question by:RichW
2 Comments
 
LVL 1

Accepted Solution

by:
vinayakrishna earned 250 total points
ID: 11949921

Use this in your code-behind page:

ddl1.Attributes.Add("onmouseout","javascript:tooltip(0);");
ddl1.Attributes.Add("onmouseover","javascript:tooltip(1);");

where ddl1 is the name of the DropDownlist ASP.NET control.

In your .aspx page add the following:

<script language="Javascript">
  function tooltip(x)
   {
       if(x==1)
       {
       document.all.tooltip.innerText = 'This is an example';
       document.all.tooltip.style.visibility ="visible";
       }
       else
       {
         //A tootip must be unshown<BR>          
         document.all.tooltip.style.visibility ="hidden";
       }
   }
</script>


Add this within your 'form' tag ;

<div class="tip" id="tooltip"></div>

Also you can apply the style sheet of your choice for the tooltip text.
0
 
LVL 4

Author Comment

by:RichW
ID: 11953174
Thanks, vinayakrishna.

I'm home from work today, and I will try this tomorrow.

I want to pass in the string for the ToolTip.  The user will make a selection from the DropDown control.  I am parsing text from the SelectedItem.Text of their selection and using that to formulate the ToolTip.  How would I pass that into your <SCRIPT> function?

If this works I will up the points.  Thanks again for your help.

RichW
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Footer for each row on Gridview 2 32
VS 2017 18 39
Input parameteres to DragOver 2 19
Upgrade code from VS 2010 to VS 2015 7 12
In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question