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

Javascript error on tooltip close

1 Answer 108 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
pixelstick
Top achievements
Rank 1
pixelstick asked on 13 Aug 2009, 04:05 AM

I'm loading a tooltip on demand using RadTooltipManager.  The tooltip displays fine, but throws an exception in javascript when it is closed.  I implemented the centering javascript code to center the tooltip in the screen (as in the Telerik example), and that seems to be what is causing the problem.  When I take the call out, there is no error.  But then, my tooltip isn't centered.  Anyone have any ideas what I'm doing wrong?

Thanks!

 

 

 

 

<telerik:RadToolTipManager ID="RadToolTipManager1" runat="server" HideEvent="ManualClose" Position="Center" ShowEvent="OnClick" RelativeTo="BrowserWindow" OnClientBeforeShow="OnClientBeforeShow" OnAjaxUpdate="OnAjaxUpdate" >

 

 

</telerik:RadToolTipManager>

 

 

 

<asp:Repeater ID="repeaterResults" runat="server" OnItemDataBound="RepeaterResults_ItemDataBound" Visible="False">

 

<HeaderTemplate>

 

<div class="additionalimagestitle">Additional Tree Images:</div>

 

</HeaderTemplate>

 

 

<ItemTemplate>

 

 

 

<div class="additionalimages_public">

 

<div class="addimage_public"><asp:Image runat="server" ID="Image" /></div>

 

<div class="addimage_public_title"><asp:Label runat="server" ID="AddImageName"><%# Eval("Name").ToString().Replace("_thumb","") %></asp:Label></div>

 

</div>

 

</ItemTemplate>

 

</asp:Repeater>

 

 

 

protected void RepeaterResults_ItemDataBound(object sender, RepeaterItemEventArgs e)

 

{

 

 

 

if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)

 

{

((

 

 

Image)e.Item.FindControl("Image")).ImageUrl = "/upfiles/assets/" + DataBinder.Eval(e.Item.DataItem, "Folder").ToString() + "/" + DataBinder.Eval(e.Item.DataItem, "Name").ToString();

 

((

 

 

Image)e.Item.FindControl("Image")).AlternateText = DataBinder.Eval(e.Item.DataItem, "Name").ToString();

 

System.Web.UI.WebControls.

 

 

Image img = (System.Web.UI.WebControls.Image)e.Item.FindControl("Image");

 

 

 

 

if (!Object.Equals(img, null))

 

{

 

 

 

string val = "http://www.huntertrees.com/" + img.ImageUrl.Replace( "_thumb", "" );

 

 

 

 

this.RadToolTipManager1.TargetControls.Add( img.ClientID, val, true );

 

}

}

}

 

 

 

 

 

 

 

protected void OnAjaxUpdate( object sender, ToolTipUpdateEventArgs args )

 

{

 

 

 

Image img = new Image( );

 

img.ImageUrl = 

 

 

args.Value;
//***** WHEN I COMMENT THE NEXT LINE OUT, NO ERROR IS GENERATED ON CLOSE *****

 

 

 

 

 

img.Attributes[

 

 

"onload"] = "centerTooltip(this); this.onload = null;";

 

args.UpdatePanel.ContentTemplateContainer.Controls.Add( img );

}

 

 

1 Answer, 1 is accepted

Sort by
0
Svetlina Anati
Telerik team
answered on 18 Aug 2009, 11:19 AM
Hello pixelstick,

What I can suggest is the following:

  1. Set RelativeTo="BrowserWindow", Position="Center" instead of centering the tooltip through script. This functionality was implemented after the example and will give the desired result out of the box. Since you want to center the tooltip you will probably also want to remove the callout and thus set ShowCallout="false". I also recommend to set RenderInPageRoot="true" to ensure that the tooltip will be rendered as child of the root element.
  2. Keep the current setup and test whether the following script fixes the issue (put it after the script manager's declaration):

    <script type="text/javascript">        
                   
           Telerik.Web.UI.RadToolTip.prototype._adjustCallout = function()        
        {        
              
        };        
            </script>      

In case the above suggestions do not help, please prepare a sample, fully runnable reproduction demo (use Northwind or a fake programmatic datasource for the grid ), open a new support ticket and send it to me along with detailed explanations and reproduction instructions and I will do my best to help.

Best wishes,
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.
Tags
ToolTip
Asked by
pixelstick
Top achievements
Rank 1
Answers by
Svetlina Anati
Telerik team
Share this question
or