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

Tooltip title when using Tooltipmanager in Grid

2 Answers 31 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
Albert Shenker
Top achievements
Rank 1
Veteran
Albert Shenker asked on 18 Sep 2014, 04:30 PM
I have a tooltip manager on a page and I tooltipify rad grid rows using the standard method outlined in the demos. I would like to specify the tooltip title based on the row. How do I do that? It doesn't look like there is any server-side access to the specific tooltip being generated in the OnAjaxUpdate event handler. I also thought maybe I could handle the OnClientBeforeShow, or OnClientShow events of the TooltipManager client-side and set the title that way, but I couldn't figure out how to either get an instance of the tooltip being generated, or pass info from the Grid ItemDatabound event to the tooltip so I can use the set_title() method.

2 Answers, 1 is accepted

Sort by
0
Accepted
Marin Bratanov
Telerik team
answered on 19 Sep 2014, 12:38 PM

Hello Albert,

The OnClientShow event receives the tooltip instance as its first argument: http://www.telerik.com/help/aspnet-ajax/tooltip-client-show.html. This example shows a RadToolTip, but the same applies for a RadToolTipManager.

There is also a common class that lets you get the currently active tooltip: http://www.telerik.com/help/aspnet-ajax/tooltip-client-side-overview.html.

So, you can use this reference and set the title via JavaScript, for example: http://www.telerik.com/help/aspnet-ajax/tooltip-client-side-radtooltip.html (see the set_title() method).

You can base that decision on several factors, for example:

  • the get_value() method will provide the Value contents. If this does not suffice, you can concatenate the desired title on the server, e.g. "desiredValue|desiredTitle" and split() the string according to the used symbol.
  • the get_targetControl() method will return the DOM object of the tooltip target. You can use it to extract text or a custom attribute from it so you can set the title accordingly

Yet another option is to register a script that will execute after the AJAX request returns (http://www.telerik.com/help/aspnet-ajax/window-troubleshooting-javascript-from-server-side.html) that will set the desired title on the currently active tooltip (see the beginning of the post).


Regards,

Marin Bratanov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Albert Shenker
Top achievements
Rank 1
Veteran
answered on 19 Sep 2014, 02:25 PM
Thanks. I used the method of obtaining the tooltip targetControl client-side. In the grid ItemDatabound event handler, I set an attribute on the target control, and then read this client side. It works well. It would be great if the Telerik TargetControlCollection, and Add method provided a way to supply additional attributes, aside from just a single value, and then have these available client-side. This would be powerful and would make it unnecessary to rely on target control dom variations.
Tags
ToolTip
Asked by
Albert Shenker
Top achievements
Rank 1
Veteran
Answers by
Marin Bratanov
Telerik team
Albert Shenker
Top achievements
Rank 1
Veteran
Share this question
or