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

tooltip error using onajaxupdate in master page

1 Answer 60 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
steve matheson
Top achievements
Rank 2
steve matheson asked on 17 Oct 2009, 10:27 PM
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>

 

1 Answer, 1 is accepted

Sort by
0
Svetlina Anati
Telerik team
answered on 22 Oct 2009, 08:19 AM
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.
Tags
ToolTip
Asked by
steve matheson
Top achievements
Rank 2
Answers by
Svetlina Anati
Telerik team
Share this question
or