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

"Dynamic" tooltip with LoadOnDemand

2 Answers 221 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
Loy Chan
Top achievements
Rank 1
Loy Chan asked on 02 May 2008, 09:12 PM
I have an application that consists of a third party spreadsheet (farpoint) control. Within this control, I want to be able to click on a specific cell and have a tooltip appear that will display detailed information.

The problem here is that I don't have access to an actual control so that I can add the control to the RadToolTipManager. So I thought I could do all this client side.

I added the following client side code (note: Fp1 is my spreadsheet control):

function OnCellClick() {  
    var Fp1 = $get('ctl00_chpMain_Fp1');  
      
    if (Fp1.ActiveCol == 0)  
    {  
        var ttmEmployeeDetails = $find('ctl00_chpMain_ttmClientInfo');  
        ttmEmployeeDetails.set_targetControl(Fp1.GetCellByRowCol(Fp1.ActiveRow, 0));    
        ttmEmployeeDetails.show();  
    }  

and server side code:

<rad:RadToolTipManager ID="ttmClientInfo" runat="server"   
    Position="BottomRight" RelativeTo="Mouse" Sticky="true" ShowEvent="FromCode" ManualClose="true"          
    Animation="None" OnAjaxUpdate="ttmClientIfo_AjaxUpdate" 
    Width="380px"   
    Height="250px">  
</rad:RadToolTipManager>       

This works fine to bring up a tooltip window in the appropriate place but I can't seem to find a way to force an AjaxUpdate.

Any help?

2 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 07 May 2008, 01:31 PM
Hi Loy Chan,

The problem in this case is that you are using a reference to the RadToolTipManager while you should use one to the corresponding RadToolTip instead - on the client, the RadToolTipManager creates a number of tooltips which are the ones that initiate the Ajax Request.
What you need to do is theoretically possible with the current implementation of the RadToolTip control, but it is very hard to achieve. Because of this and the fact that we are planning to improve the logic for this scenario in the service pack, we strongly recommend to wait for SP1 which will appear next week. We are also planning to provide a demo that will show how to achieve the desired functionality and we will do our best to provide it for the service pack as well.


Regards,
Georgi Tunev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Tervel
Telerik team
answered on 13 May 2008, 04:23 PM
Hello all,

We just made some extensions to the RadToolTipManager client-API to make such a task easier. The Q1 SP1 will be released by the end of this week, and will feature the changes.

Here is a code sample that we prepared to demonstrate the approach we suggest (with a dynamically created tooltip on the client, as well as using AJAX)

function showToolTip(element)  
                {  
                   var tooltipManager = $find("<%= RadToolTipManager1.ClientID %>");  
                     
                   //Find the tooltip for this element if it has been created   
                   var tooltip = tooltipManager.getToolTipByElement(element);  
                     
                   //Create a tooltip if no tooltip exists for such element  
                   if (!tooltip)  
                   {                          
                        tooltip = tooltipManager.createToolTip(element);  
                   }  
                                                                                                 
                   //Show the tooltip with the message [if any message is provided]  
                   //if (message) tooltip.set_text(message);  
                     
                   //Set a server-side value to be delivered in the AJAX event  
                   //In this case we set the client ID of the target control itself  
                   tooltip.set_value(element.getAttribute("id"));                                        
                   tooltip.show();                                                          
                } 

It is important to prevent the tooltip manager from tooltipifying the whole page by setting AutoTooltipify="false",
also, you should "inform" the tooltip manager that showing of tooltips will be programmatic, and not using the mouse for example, so you need to set ShowEvent="FromCode".

E.g.

<telerik:RadToolTipManager ID="RadToolTipManager1" runat="server"

AutoTooltipify="false"
OnAjaxUpdate="OnAjaxUpdate"
ShowEvent="FromCode"
></telerik:RadToolTipManager>




All the best,
Tervel
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
ToolTip
Asked by
Loy Chan
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Tervel
Telerik team
Share this question
or