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

RadToolTipManager + asp:UpdatePanel = “Cannot unregister UpdatePanel with ID 'RadToolTipManager1RTMPanel'…”

9 Answers 312 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
Claiton Lovato
Top achievements
Rank 1
Claiton Lovato asked on 21 Jan 2010, 12:10 PM

Here is my situation, I have a UserControl that has a simple Image, Label and a RadToolTipManager that gets the tooltip info via a WebService for both the Image and the Label. This UserControl is used on a RadGrid that goes inside an asp:UpdatePanel on a page Default.aspx. Inside the UpdatePanel I also have a RadTreeView that updates the content of the Grid on the onNodeClick event and the Default.aspx implements a MasterPage that has the asp:ScriptManager.

Great, so the on the Load of the Default.aspx page I load the TreeView and force the onNodeClick of the RootNode so the Grid is populated too. Until this point all works fine, the control displays the information fine and the RadToolTipManager shows the tooltip info from the WebService also fine.

 

The problem comes when I click on a different Node from the TreeView to and I reload the Grid contents causing the error:

“Cannot unregister UpdatePanel with ID 'RadToolTipManager1RTMPanel' since it was not registered with the ScriptManager. This might occur if the UpdatePanel was removed from the control tree and later added again, which is not supported.

Parameter name: updatePanel”

 

This error occur on the Grid.DataBind() line on the Default.aspx page.

 I have a simple solution that replicates the problem but can't upload the files here, so will put some snippets below...

I already tried to use ScriptManagerProxy on both the Default.apsx and the Control.ascx, also tried to use the RadAjaxPanel instead of the UpdatePanel or using RadAjaxManager and RadAjaxManagerProxy and follow both (the only ones I could find) treads Compatibility with .NET 3.5 UpdatePanel? and RadAjaxManager initialized too late in the page life cycle but nothing changed.

My last try was to Register the RadToolTipManager programmatically on the control by getting the ScriptManager Instance but if I do that I get the error on the first page load instead.

 

Well, I am quite stuck with this situation now, and because of business requirements the ToolTip on this particular page is really important for the App. Anyone has any ideas on how to fix this?

Site.Master:

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="AjaxRadTooltipError.Site" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" > 
<head runat="server">  
    <title></title>  
    <asp:ContentPlaceHolder ID="head" runat="server">  
    </asp:ContentPlaceHolder> 
</head> 
<body> 
    <form id="form1" runat="server">  
        <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true" ScriptMode="Release">  
            <Services></Services>  
            <Scripts></Scripts>      
        </asp:ScriptManager> 
        <div> 
            <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">  
              
            </asp:ContentPlaceHolder> 
        </div> 
    </form> 
</body> 
</html> 

Default.aspx:

<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="AjaxRadTooltipError.Default" %> 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
<%@ Register src="Control.ascx" tagname="Control" tagprefix="uc1" %> 
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">  
</asp:Content> 
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">  
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">  
        <ContentTemplate> 
            <telerik:RadTreeView ID="RadTreeView1" runat="server" OnNodeClick="RadTreeView1_NodeClick">  
            </telerik:RadTreeView> 
            <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="false">  
                <MasterTableView> 
                    <RowIndicatorColumn> 
                        <HeaderStyle Width="20px" /> 
                    </RowIndicatorColumn> 
                    <ExpandCollapseColumn> 
                        <HeaderStyle Width="20px" /> 
                    </ExpandCollapseColumn> 
                    <Columns> 
                        <telerik:GridTemplateColumn AllowFiltering="false" Resizable="true" HeaderText="Name" UniqueName="ItemName" ItemStyle-Width="300px">  
                            <ItemTemplate> 
                                <uc1:Control ID="Control1" runat="server" /> 
                            </ItemTemplate> 
                        </telerik:GridTemplateColumn> 
                    </Columns> 
                </MasterTableView> 
            </telerik:RadGrid> 
        </ContentTemplate> 
    </asp:UpdatePanel> 
</asp:Content> 

Default.aspx.cs:

protected void Page_Load(object sender, EventArgs e) {  
    if (!IsPostBack)  
        LoadTreeView();  
}  
 
protected void LoadTreeView() {  
    RadTreeNode Node = new RadTreeNode();  
    Node.Text = "Root Node";  
    Node.Value = "0";  
 
    for (int count = 1; count <= 10; count++) {  
        RadTreeNode SubNode = new RadTreeNode();  
        SubNode.Text = "Node " + count.ToString();  
        SubNode.Value = count.ToString();  
        Node.Nodes.Add(SubNode);  
    }  
    RadTreeView1_NodeClick(thisnew RadTreeNodeEventArgs(Node));  
    RadTreeView1.Nodes.Add(Node);  
}  
protected void RadTreeView1_NodeClick(object sender, RadTreeNodeEventArgs e) {  
    List<string> myDummyList = new List<string>();  
    for (int count = 0; count <= 2 + Convert.ToInt32(e.Node.Value); count++) {  
        myDummyList.Add(count.ToString());  
    }  
 
    RadGrid1.DataSource = myDummyList;  
    RadGrid1.DataBind(); // Error happens here!  

Control.ascx:

 

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Control.ascx.cs" Inherits="AjaxRadTooltipError.Control" %> 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
<asp:Panel ID="Panel1" runat="server">  
    <asp:Image ID="Image1" runat="server" ImageUrl="~/ObjectItem_Page.gif" /> 
    <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> 
</asp:Panel> 
<telerik:RadToolTipManager ID="RadToolTipManager1" runat="server">  
    <WebServiceSettings Path="~/Service_GetInfo.asmx" Method="GetResourceToolTip" /> 
    <TargetControls> 
        <telerik:ToolTipTargetControl TargetControlID="Image1" /> 
        <telerik:ToolTipTargetControl TargetControlID="Label1" /> 
    </TargetControls> 
</telerik:RadToolTipManager> 


Cheers,
Claiton Lovato

 

 

 

9 Answers, 1 is accepted

Sort by
0
Svetlina Anati
Telerik team
answered on 25 Jan 2010, 04:11 PM
Hi Claiton,


I already answered your support ticket and attached your modified demo there. For your convenience and for others who might encounter teh same problem, I pasted my reply below:

Thank you for the provided demo and explanations, we were able to reproduce the problem.

The issue comes from the fact that in this scenario you have a tooltip manager inside an ItemTemplate of a grid and this means that an update panel is actually there. When you rebind the grid, it clears its Controls collection and rebuilds the controls again - however, there is a known problem with the ScriptManager control which holds a reference to the old, already not existing update panel and this causes the issue. The problem can be reproduced in this very same scenario without using RadControls at all but only standard ASP.NET controls.

What I can suggest in order to fix the problem is to put the RadToolTipManager outside the user control and e.g make public properties for the controls which should be tooltipified - in this manner you will be able to add them to the TargetControls collection in the OnItemDataBound event of the grid . For your convenience I modified and attached your demo. I hope that my explanations and the suggested solution helps, let me know how it goes.



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.
0
Giovanni De Lazzari
Top achievements
Rank 1
answered on 31 Jul 2010, 11:51 AM
Please where I can see the project modified by Svetlina  ?
thanks
Giovanni
0
Rumen
Telerik team
answered on 04 Aug 2010, 04:31 PM
Hi Giovanni,

Unfortunately, I cannot share this project, because it is private and could contain confidential information. If you would like ask Claiton to contact you and send the project.

Best regards,
Rumen
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Giovanni De Lazzari
Top achievements
Rank 1
answered on 04 Aug 2010, 04:42 PM
Thanks
how can I contact Claiton,?
there is no email on his signature
pleas ecould you send a message to him for me ?
thanks
Giovanni
delgio@gmail.com
0
Svetlina Anati
Telerik team
answered on 09 Aug 2010, 09:36 AM
Hi Giovanni De Lazzari,


Please, note, that if you get similar or the same error, there is no guarantee that the reason for the issue is the same as in the other scenario and usually every separate setup should be debugged individually. However, since we cannot provide you with the code of another customer, I will explain to you in brief what was the setup in this demo so that you can check your application for this particular case.

The issue in the sample in mention comes from the fact that in this scenario you have a tooltip manager with OnAjaxUpdate event attached inside an ItemTemplate of a grid and this means that an update panel is actually there. When you rebind the grid, it clears its Controls collection and rebuilds the controls again - however, there is a known problem with the ScriptManager control which holds a reference to the old, already not existing update panel and this causes the issue. The problem can be reproduced in this very same scenario without using RadControls at all but only standard ASP.NET controls.

What I can suggest in order to fix the problem is to put the RadToolTipManager outside the grid's item template but on the main page.

If this is not the case in your project, please prepare a simple reproduction demo, open a new support ticket and send it to us and we will debug it and provide you with a fix so that you will be then able to incorporate it in your original application.


Regards,
Svetlina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Jean-Francois
Top achievements
Rank 1
answered on 07 Oct 2010, 04:56 PM
How can Telerik suggest to put the RadToolTipManager out of the grid... trully illogical!!
0
Svetlina Anati
Telerik team
answered on 12 Oct 2010, 09:35 AM
Hi Jean-Francois,

 Would you please explain what exactly you find illogical in having the RadToolTipManager outside the item template? Please, note that the RadToolTipManager is not RadToolTip - it is a manager control which creates RadToolTips and only one RadToolTipManager control can generate all the needed tooltips and having more than one if it with the same settings just makes performance worse without any benefit. The scenario which makes it logical to embed in item template is when a single RadToolTip is used, not a RadToolTipManager and there are not problems with this since it does not contain an update panel. Please, examine the following demo to understand the difference between RadToolTip and RadToolTipManager which are different controls:

http://demos.telerik.com/aspnet-ajax/tooltip/examples/tooltipversustooltipmanager/defaultcs.aspx

I also suggest to examine the other demos to get a better understanding of the RadToolTip and RadToolTipManager controls, how they are configured and how they work.

On a side note, the very same problem can be reproduced in the same scenario with standard asp controls only when you clear the Controls collection and recreate it again and this is how ASP.NET works and it is not directly related to RadControls.

Best wishes,
Svetlina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Eirik H
Top achievements
Rank 2
answered on 25 Apr 2012, 10:27 AM
Sorry for resurrecting this old thread, but I've struggled with this problem for two days now since the proposed solution is not viable in our case (for architectural reasons the RadToolTipManager can't reside outside of the item template).

So without further ado, here is my solution. Only tested briefly and by using a WebService, might not work with the load on demand AjaxUpdate method of the RadToolTipManager.

1. Create a class that inherits from RadToolTipManager, I've called it RadToolTipManagerFixed:

Public Class RadToolTipManagerFixed
        Inherits RadToolTipManager
 
        Public Sub New()
            MyBase.New()
            AddHandler Me.UpdatePanel.Unload, AddressOf Me.UpdatePanel_Unload
        End Sub
 
        Protected Sub UpdatePanel_Unload(ByVal sender As Object, ByVal e As EventArgs)
            Dim methodInfo As MethodInfo = GetType(ScriptManager).GetMethods(BindingFlags.NonPublic Or BindingFlags.Instance).Where(Function(i) i.Name.Equals("System.Web.UI.IScriptManagerInternal.RegisterUpdatePanel")).First()
            methodInfo.Invoke(ScriptManager.GetCurrent(Page), New Object() {TryCast(sender, UpdatePanel)})
        End Sub
    End Class

You'll need Imports System.Reflection as well.

2. Use it in you .aspx!

Before:

<telerik:RadToolTipManager runat="server" ID="ToolTipMngr">
    <WebServiceSettings Path="~/WebServices/MyService.asmx" Method="GetUserInfo" />
</telerik:RadToolTipManager>

After:

<%@ Register Namespace="Your.Namespace" TagPrefix="UC" %>
<UC:RadToolTipManagerFixed Skin="Vista" runat="server" ID="ToolTipMngr">
    <WebServiceSettings Path="~/WebServices/MyService.asmx" Method="GetUserInfo" />
</UC:RadToolTipManagerFixed>

Btw, Telerik: Why don't you just use your own RadAjaxPanel here instead of MS's, wouldn't that solve it? Or at least unregister the update panel with the scriptmanager on unload like described above?

Source: http://msmvps.com/blogs/luisabreu/archive/2006/11/16/adding-removing-updatepanels-dynamicaly-from-a-page.aspx 
0
Svetlina Anati
Telerik team
answered on 03 May 2012, 11:11 AM
Hello Eirik,

 
Thank you very much for your input and for raising the priority of resolving this scenario. The problem occurs due to the update panel being removed and readded.

What happens is summarized below:

during the Init event, the UpdatePanel registers itself with the ScriptManager control;

  1. when it's removed from a control's collection, the UpdatePanel unregisters itself with the ScriptManager control;
  2. the UpdatePanel is added again to another control's collection
  3. during the OnUnload event of the page, the UpdatePanel tries to unregister with ScriptManager
  4. since it's not in the list, ScriptManager generates an exception

Your solution is to register the update panel in Unload, just before it will try to unregister itself. However, we decided that it will be better to register it when it is created since the correct behavior is that the ScriptManager "knows" about update panels.

So in brief:

1) We fixed the problem and you could decide to keep or remove the workaround once you upgrade to the upcoming major version of RadControls - it should work in both cases

2) We appreciate your input and we updated your account with some Telerik points for your kind cooperation

On a side note, a detailed article on the problem is available here:

http://msmvps.com/blogs/luisabreu/archive/2006/11/16/adding-removing-updatepanels-dynamicaly-from-a-page.aspx

Kind regards,
Svetlina Anati
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
ToolTip
Asked by
Claiton Lovato
Top achievements
Rank 1
Answers by
Svetlina Anati
Telerik team
Giovanni De Lazzari
Top achievements
Rank 1
Rumen
Telerik team
Jean-Francois
Top achievements
Rank 1
Eirik H
Top achievements
Rank 2
Share this question
or