Tooltip Client-side runtime error (Positioning Exception)

2 posts, 0 answers
  1. Jordan
    Jordan avatar
    16 posts
    Member since:
    Nov 2007

    Posted 12 Dec 2007 Link to this post

    I have an upload button with a status icon next to it:

    <tr runat="server" id="tr_upload"
       <td> 
          Podcast File: 
       </td> 
       <td> 
          <asp:FileUpload runat="server" ID="fupPodcast" />  
          <asp:Button runat="server" ID="btnFileUpload" Text="Upload" Height="22px" /> 
       </td> 
       <td style="text-align: right; width: 40px;"
          <asp:Image  runat="server" ID="imgPodcastFeedback" ImageUrl="~/Images/checkmark.png" ImageAlign="AbsMiddle" /> 
          <telerik:RadToolTip ID="RadToolTip1" runat="server" Animation="None" TargetControlID="imgPodcastFeedback" Position="TopRight" AutoCloseDelay="0" HideDelay="500" Width="200px"
             <asp:Label runat="server" ID="lblToolTip1"></asp:Label> 
         </telerik:RadToolTip> 
       </td> 
    </tr> 

    When the status icon is moused-over, the tooltip is shown. I also wanted the tooltip to display when the user moused over the "Upload" button, so I added this code:

    btnFileUpload.Attributes.Add("onmouseover""ForceTooltip('" + RadToolTip1.ClientID + "', 'SHOW')"); 
    btnFileUpload.Attributes.Add("onmouseout""ForceTooltip('" + RadToolTip1.ClientID + "', 'HIDE')"); 

    ForceTooltip is a javascript function that looks like this:

    function ForceTooltip(id, action) 
        var tooltip = $find(id); 
     
        if(action == "SHOW"
            tooltip.show(); 
        else 
            tooltip.hide(); 

    The bug occurs when I mouse over the button BEFORE I have moused over the status icon. When I load the page and mouse over the icon, the tooltip repositions itself. After that the upload button mouseover works as expected.

    However after initial load, if I mouse over the button before the icon, I get an exception:

    A Runtime Error has occurred.
    Do you wish to Debug?

    Line: 6170
    Error: Sys.ArgumentOutOfRangeException: Value must be an integer.
    Parameter name: x
    Actual value was NaN.


    Note that the code here may not reproduce the error, as my button/icon/tooltip is inside a radpane in a contentplaceholder.

    My app is written for ASP.NET 2.0. Please help!
  2. Tervel
    Admin
    Tervel avatar
    1337 posts

    Posted 13 Dec 2007 Link to this post

    Hello Jordan,

    By default a RadTooltip displays itself relative to the mouse, and it calculates its position with respect to the mouse. When showing the tooltip programmatically, there is no mouse event triggered- hence the error.

    What you need to do is set RelativeTo="Element" and all should work OK.

    Best wishes,
    Tervel
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top