This is a migrated thread and some comments may be shown as answers.

tooltip and dropdownlist

7 Answers 167 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
Dave
Top achievements
Rank 1
Dave asked on 15 Jan 2008, 03:57 PM
How do I implement the radtooltip for use on a dropdownlist?  I have a dropdownlist that is populated from an access database.  I am showing the abbreviations for the job types as the "Text" of the dropdownlist.  I would like to show the descriptions of the job types in a tooltip as the user mouses over each selection.  I am coding in VB.

Thank you,
Dave Durose

7 Answers, 1 is accepted

Sort by
0
Tervel
Telerik team
answered on 16 Jan 2008, 08:37 AM
Hello Dave,

In case you review the HTML that represents the DropDownList control, you will notice that it is something like:

SELECT
-OPTION
-OPTION

As the OPTION element is not a real HTML object, it cannot be configured to display even the plain [browser] tooltip. That is why, there is no way to make the manager tooltipify the items of the DropDownList - as it cannot find those, and they do not trigger mouse events that the tooltip uses to display itself.

In case you decide to use a RadCombo to display your data, it will be possible to tooltipify the items.

Kind regards,
Tervel
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Tree
Top achievements
Rank 1
answered on 20 Jan 2008, 04:21 PM
OK, so how does one tooltipify RadComboBox items?  Can you show me how to do it for RadCombBox templated items. 

I have template that includes a checkbox, the item text, and an "?" icon.  I want to display the tooltip when the user hovers over the "?" icon.
0
Tervel
Telerik team
answered on 21 Jan 2008, 01:31 PM
Hello Eriksson,

This is possible to do, and we will gladly help you with this.
Our suggestion is to fully implement your scenario, so that the default browser tooltip would appear over each image, and show the required information.

Once you are done with it, please open a support ticket and send us a working project. We will make the necessary changes to use RadToolTip and send it back to you.

Best wishes,
Tervel
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Dave
Top achievements
Rank 1
answered on 21 Jan 2008, 03:44 PM
I am trying to do the same thing as Eriksson (adding RadTooltips to a RadComboBox).  I would love to add a "?" icon next to each option in the drop-down that when moused over would show a description of the option.  Eriksson - could you show me the code that you implemented to do this?  Or perhaps I could get the necessary code from Telerik.  Either way.  Please let me know.

Thanks,
Dave
0
Tree
Top achievements
Rank 1
answered on 21 Jan 2008, 03:56 PM
Good timing!  I just just finished this and it seems to work crudely.

I create a tooltip in a radcomboitem template and set its text property during radcomboitem databind event.

Note that in the databind event handler I am extracting the text to show in the tooltip (actually html markup in my case) from the 6th character onwards of the RadComboItem.Value member.  This is because I actually store two things in the Value string: an Id that is 0-padded to 5 characters, and then the tooltip.  I use the Id for an url parameter when user clicks the item.

Trust that this all makes sense

E

<p>
Filter by Domain:
<rad:RadComboBox
ID="RadComboBox_Domains"
Width="450px"
runat="server">
<ItemTemplate>
<%# DataBinder.Eval(Container, "Text")%>
&nbsp;
<asp:Image ID="Image1" runat="server" ImageUrl="~/Images/question-small.png" />
<telerik:RadToolTip
ID="RadToolTip1"
runat="server">
</telerik:RadToolTip>
</ItemTemplate>
</rad:RadComboBox>
</p>

Then in my aspx.cs file:

protected void CategoryRadComboBoxes_ItemDataBound(object o, RadComboBoxItemDataBoundEventArgs e)
{
//DataRowView dataSourceRow = (DataRowView)e.Item.DataItem;

String QuestionMarkImageClientID = e.Item.FindControl("Image1").ClientID;
((RadToolTip)e.Item.FindControl("RadToolTip1")).IsClientID = true;
((RadToolTip)e.Item.FindControl("RadToolTip1")).TargetControlID = QuestionMarkImageClientID;
((RadToolTip)e.Item.FindControl("RadToolTip1")).Text = e.Item.Value.Substring(5);
((RadToolTip)e.Item.FindControl("RadToolTip1")).Sticky = false;
}
0
Tervel
Telerik team
answered on 21 Jan 2008, 05:22 PM
Hello Eriksson,

You have taken the right approach, and we are glad to see you were able to succeed on our own.
Should other questions arise, do not hesitate to contact us.

One thing we would recommend is optimizing the code - create a reference to the tooltip
RadToolTip tip = ((RadToolTip)e.Item.FindControl("RadToolTip1"));

Then use it to set all required properties. Also - the  Sticky property is false by default, so you do not need to set it explicitly.

Greetings,
Tervel
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Tree
Top achievements
Rank 1
answered on 21 Jan 2008, 05:27 PM
Tervel,  Thanks for taking the time to review my code and to suggest improvements.
Tags
ToolTip
Asked by
Dave
Top achievements
Rank 1
Answers by
Tervel
Telerik team
Tree
Top achievements
Rank 1
Dave
Top achievements
Rank 1
Share this question
or