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

Load usercontrol as tooltip client-side

3 Answers 176 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
Mattias
Top achievements
Rank 1
Mattias asked on 26 Feb 2009, 08:23 AM
Hi,
is it possible to load a usercontrol client-side to show as tooltip?

I have problems with using the manager.targetcontrols.add... it feels like random, sometimes the tooltip shows up sometimes it doesn't.
So I want to try load the tooltip client-side instead.
I checked out some examples with client-side code:
    function showToolTip(element, id) { 
        var tooltipManager = $find("<%= radToolTipManager.ClientID %>"); 
 
        //If the user hovers the image before the page has loaded, there is no manager created 
        if (!tooltipManager) return
 
        //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); 
 
            //Use the fact that the image was named after a country 
            //Extract the country name from the image, and set it as the value to be supplied to the web-service 
            //var src = element.getAttribute("src", 2); 
            //var country = src.substring (src.lastIndexOf("/") + 1, src.lastIndexOf(".")); 
            alert(id);
            tooltip.set_value(id); 
        } 
 
        tooltip.show(); 
    } 

<telerik:RadToolTipManager ID="radToolTipManager" runat="server" Position="BottomRight" Animation="None" AutoTooltipify="false"  
    Skin="Hay" EnableEmbeddedSkins="false" EnableEmbeddedBaseStylesheet="false" AutoCloseDelay="0" ShowDelay="100" CssClass="tooltip"  
    Width="300" Height="200" OffsetX="10" OffsetY="10"
    <WebServiceSettings Method="GetToolTip" Path="/usercontrols/Tooltip.ascx" /> 
</telerik:RadToolTipManager> 


So far so good, the id is the correct one when I hoover.

Just for fun I tried to set the usercontrol in the managers webservicesettings but when running I get:
The server method 'GetToolTip' failed.

Can this work or do I have to use targetcontrols.add...?

Thanks!

/Mattias

3 Answers, 1 is accepted

Sort by
0
Svetlina Anati
Telerik team
answered on 04 Mar 2009, 09:19 AM
Hi Mattias,

Straight to your questions:

  1. When adding the target controls to the TargetControls collection you should not experience "random behavior" - this might happen due to configuration, e.g the provided ids are not correct, you make updates either of the target controls or the manager incorrectly, etc. If you want, you can prepare a sample demo which is fully runnable, open a new support ticket and send it to me along with detailed explanations of the actual and the desired behavior and I will make it meet your requirements.
  2. The error you describe in the client-side approach is not caused by the RadToolTipManager but the problem is in the Web method called GetToolTip - please debug it and find where is the problem. Make also sure that it returns correct data in correct format.

Sincerely yours,
Svetlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Dinesh
Top achievements
Rank 1
answered on 31 Jan 2011, 05:49 PM
HI,

How to pass multiple values to the web service. I want to show the tool tip based on three parameters. I can either go with server side or client side, but client side script looks simple. Please tell me how to pass multiple parameters to my web service from the client side.

Thanks
Dinesh
0
Svetlina Anati
Telerik team
answered on 03 Feb 2011, 10:41 AM
Hi Dinesh,

Since the RadToolTipManager provides the ability to pass a string, it is up to you how to organize this string. What I suggest is to concatenate all the parameters separated with some separator sign and form one resultant string which contains all the parameters and pass it as a value. After that you should simply split the string according to the used separator on the server and you will get your multiple parameters.

This is a standard ASP.NET technique which is not directly related to RadControls  and I believe that it will be helpful in this case. In addition, splitting a string is an operation which is available and easy to do both on the server and on the client.

All the best,
Svetlina
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
ToolTip
Asked by
Mattias
Top achievements
Rank 1
Answers by
Svetlina Anati
Telerik team
Dinesh
Top achievements
Rank 1
Share this question
or