This is a migrated thread and some comments may be shown as answers.
Cannot unregister UpdatePanel with ID 'RadWindow1$C$rdDemoPanel' since it was not registered with the ScriptManager. This might occur if the UpdatePanel was removed from the control tree and later add
5 Answers 61 Views
This is a migrated thread and some comments may be shown as answers.
Dorababu
Top achievements
Rank 1
Dorababu asked on 26 Jun 2012, 03:36 PM
Getting the following error when I am using RadAjaxPanel

Cannot unregister UpdatePanel with ID 'RadWindow1$C$rdDemoPanel' 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


My design is as follows
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="radajaxpanel1.aspx.cs" Inherits="radajaxpanel1" %>
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
        <telerik:RadWindowManager ID="RadWindowManager1" runat="server" Behavior="Default"
            InitialBehavior="None">
            <Shortcuts>
                <telerik:WindowShortcut CommandName="CloseAll" Shortcut="Esc" />
            </Shortcuts>
            <Windows>
                <telerik:RadWindow ID="RadWindow1" runat="server" Behaviors="Default" InitialBehaviors="None"
                    OpenerElementID="btn" Width="650" Height="480" VisibleOnPageLoad="false">
                    <ContentTemplate>
                        <telerik:RadAjaxPanel ID="rdDemo" runat="server"  LoadingPanelID="RadAjaxLoadingPanel1">
                            <telerik:RadComboBox ID="rdcmb" runat="server" AutoPostBack="true" OnSelectedIndexChanged="sel">
                                <Items>
                                    <telerik:RadComboBoxItem Text="One" Value="One" />
                                    <telerik:RadComboBoxItem Text="Two" Value="Two" />
                                    <telerik:RadComboBoxItem Text="Three" Value="Three" />
                                    <telerik:RadComboBoxItem Text="Four" Value="Four" />
                                </Items>
                            </telerik:RadComboBox>
                            <telerik:RadTextBox ID="rdText" runat="server">
                            </telerik:RadTextBox>
                            <telerik:RadButton ID="radbtn" runat="server" Text="Save" OnClick="btn_Click">
                            </telerik:RadButton>
                        </telerik:RadAjaxPanel>
                    </ContentTemplate>
                </telerik:RadWindow>
            </Windows>
        </telerik:RadWindowManager>
    </div>
    </form>
</body>
</html>

My code is as follows

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
 
public partial class radajaxpanel1 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
 
    }
    protected void sel(object sender, EventArgs e)
    {
        rdText.Text = rdcmb.SelectedItem.Text;
    }
    protected void btn_Click(object sender, EventArgs e)
    {
        RadWindowManager1.Windows[0].VisibleOnPageLoad = false;
        RadWindowManager1.Windows[0].Visible = false;
    }
}

5 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 27 Jun 2012, 10:15 AM
Hi Dorababu,

What actually happens is that when the RadWindow is added to the RadWindowManager it is actually moved in its Controls collection and this happens in the CreateChildControls event of the manager while the update panel registers itself in the Init event which is earlier in the lifecycle

Here the resolution of the issue is to add the RadWindow in the PreInit event this cannot be fixed in the source code because it is to early to add the RadWindow there and will affect the current functionality.

In such setup we can suggest the following two simple solutions

1) You can declare a separate RadWindow directly on the page instead of in the RadWindowManager - it will function as expected and there is no limitation or additional load to use the control separately.

2) You can use RadAjaxManager for ajaxifying. 

Thanks,
Shinu.
0
Dorababu
Top achievements
Rank 1
answered on 27 Jun 2012, 10:41 AM
Can I have a sample example please
0
Maria Ilieva
Telerik team
answered on 29 Jun 2012, 01:42 PM
Hi Dorabubu,

Try the following approach:
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="Contentpanel">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="Contentpanel" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server" Behavior="Default"
        InitialBehavior="None">
        <Shortcuts>
            <telerik:WindowShortcut CommandName="CloseAll" Shortcut="Esc" />
        </Shortcuts>
        <Windows>
            <telerik:RadWindow ID="RadWindow1" runat="server" Behaviors="Default" InitialBehaviors="None"
                OpenerElementID="btn" Width="650" Height="480" VisibleOnPageLoad="false">
                <ContentTemplate>
                    <asp:Panel ID="Contentpanel" runat="server">
                        <telerik:RadComboBox ID="rdcmb" runat="server" AutoPostBack="true" OnSelectedIndexChanged="sel">
                            <Items>
                                <telerik:RadComboBoxItem Text="One" Value="One" />
                                <telerik:RadComboBoxItem Text="Two" Value="Two" />
                                <telerik:RadComboBoxItem Text="Three" Value="Three" />
                                <telerik:RadComboBoxItem Text="Four" Value="Four" />
                            </Items>
                        </telerik:RadComboBox>
                        <telerik:RadTextBox ID="rdText" runat="server">
                        </telerik:RadTextBox>
                        <telerik:RadButton ID="radbtn" runat="server" Text="Save" OnClick="btn_Click">
                        </telerik:RadButton>
                    </asp:Panel>
                </ContentTemplate>
            </telerik:RadWindow>
        </Windows>
    </telerik:RadWindowManager>


Kind regards,
Maria Ilieva
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.
0
Dorababu
Top achievements
Rank 1
answered on 29 Jun 2012, 02:07 PM
Hi Maria Ilieva   This works fine but on button click I am writing as follows which didn't work for me

protected void btn_Click(object sender, EventArgs e)
   {
       RadWindowManager1.Windows[0].VisibleOnPageLoad = false;
   }

0
Maria Ilieva
Telerik team
answered on 04 Jul 2012, 02:02 PM
Hi Dorabubu,

The presented behaviour is expected as only the controls in the content template are ajaxified and the button does not update the Window itself. In this scenario I would suggest you to RegisterStartupScript() server method to invoke the client method than injecting the script and see whether it helps.

The KB Article shows how to show radalert from code behind. Use the same logic to invoke the client function which closes the window.
KB Article : Calling radalert from codebehind

Kind regards,
Maria Ilieva
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
Ajax
Asked by
Dorababu
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Dorababu
Top achievements
Rank 1
Maria Ilieva
Telerik team
Share this question
or