tooltip error using onajaxupdate in master page

2 posts, 0 answers
  1. steve matheson
    steve matheson avatar
    28 posts
    Member since:
    Jul 2005

    Posted 17 Oct 2009 Link to this post

    I am using the q1 2009 version of tooltip (in VB) to create a user control that opens a tooltip from a javascript function (a dbl click on some text) and then loads a user control into the tooltip. The idea will be to feed the selected text into a database query in the new user control.

    Currently this works fine when running in a stand-alone page but when it is added to a master page or template page
    when the tooltip opens I get a javascript error: " LENGTH is null or is not an object"
    I've tried numerous ideas and have tried to find some relevant references in the forums but have not found a fix that works yet.
    What is the best way to avoid this error?

    A basic version of the code used for the user control containing the tooltip manager is below:



    <

     

    script runat="server">

     

     

    Protected Sub tooltipupdate(ByVal sender As Object, ByVal e As Telerik.Web.UI.ToolTipUpdateEventArgs)

     

     

    Dim ctrl As Control = New Control

     

    ctrl = Page.LoadControl(

    "~/controls/usercontrol1.ascx")

     

    e.UpdatePanel.ContentTemplateContainer.Controls.Add(ctrl)

     

    End Sub

     

    </

     

    script>

     

    <

     

    div>

     

     

    <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">

     

     

    <script type="text/javascript">

     

     

     

    function showToolTip(element)

     

    {

     

     

     

    var searchString = "";

     

     

    if (window.document.selection)

     

    {

     

    var rng = window.document.selection.createRange();

     

    searchString = rng.text;

    }

     

    else if (window.getSelection)

     

    {

    searchString = window.getSelection().toString();

    }

     

    if (searchString)

     

    {

     

    var tooltipManager = $find("<%= RadToolTipManager1.ClientID %>");

     

     

     

    if (!tooltipManager) return;

     

     

     

    var tooltip = tooltipManager.getToolTipByElement(element);

     

    tooltip = tooltipManager.createToolTip(element);

    tooltip.set_value(searchString);

     

    element.onmouseover =

    null;

     

    tooltip.show();

    }

    }

     

     

     

    </script>

     

     

    </telerik:RadScriptBlock>

     

     



    <
    telerik:RadToolTipManager ID="RadToolTipManager1"

     

     

    Width="400px"

     

     

    height="200px"

     

     

    RelativeTo="BrowserWindow"

     

     

    Position="Center"

     

     

    runat="server"

     

     

    Onajaxupdate="tooltipupdate"

     

     

    AutoTooltipify="false"

     

     

     

    >

     

     

     

    </telerik:RadToolTipManager>

     

     

    <div runat="server" id="dblclk1" ondblclick="showToolTip(this)" >some text here</div>

     

    </

     

    div>

     

  2. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 22 Oct 2009 Link to this post

    Hello steve,

    I examined your code and I also built up a test demo based on it but unfortunately to no avail - I did not get any error. Would you please examine my test page and let me know what should I do in order to replicate the problem? Once I analyze the problem locally, I will do my best to help.


    Kind regards,
    Svetlina
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top