Hi guys,
I’m having a issue with a RadWindow which contains an UpdatePanel in combination with the RadWindowManager.
When the popup is added during a GET request it throws an error:
Cannot unregister UpdatePanel with ID 'test' 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.
When I disable the line: “createRadWindow()” it works and the popup is visible.
Why can’t the popup be created during a GET request?
I’ve read this page: http://www.telerik.com/support/kb/aspnet-ajax/window/cannot-unregister-updatepanel-with-id-updatepanelid-since-it-was-not-registered-with-the-scriptmanager.aspx
But I use the RadWindowManager because it recreates the RadWindow from the ViewState in a postback request.
In short I have two questions:
How can I fix this issue? I Need the RadWindowManager to recreate my windows so events for controls on these dialogs work properly.
Why does the popup work when created from a postback and not from a get request.
Kind regards,
DvdBrink
Below is my sample code
aspx code
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="TelerikRadWindowIssue.Default" %>
<%@ 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">
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
runat
=
"server"
>
<
title
></
title
>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
div
>
<
asp:ScriptManager
ID
=
"ScriptManager1"
runat
=
"server"
>
</
asp:ScriptManager
>
<
asp:UpdatePanel
ID
=
"upanel"
runat
=
"server"
ChildrenAsTriggers
=
false
UpdateMode
=
Conditional
>
<
ContentTemplate
>
<
telerik:RadWindowManager
ID
=
"RadWindowManager1"
runat
=
"server"
>
</
telerik:RadWindowManager
>
</
ContentTemplate
>
</
asp:UpdatePanel
>
<
asp:Button
ID
=
"Button1"
runat
=
"server"
Text
=
"Button"
/>
</
div
>
</
form
>
</
body
>
</
html
>
CSharp code
using
System;
using
System.Web.UI;
using
Telerik.Web.UI;
namespace
TelerikRadWindowIssue
{
public
partial
class
Default : System.Web.UI.Page
{
protected
override
void
OnInit(EventArgs e)
{
ScriptManager1.RegisterAsyncPostBackControl(Button1);
Button1.Click +=
new
EventHandler(Button1_Click);
createRadWindow();
//With this line enabled the page crashes
//Disable and click on the button, same code, but the window opens correctly
base
.OnInit(e);
}
void
Button1_Click(
object
sender, EventArgs e)
{
createRadWindow();
upanel.Update();
}
private
void
createRadWindow()
{
TestWindow window =
new
TestWindow();
RadWindowManager1.Windows.Add(window);
}
private
class
TestWindow : RadWindow
{
public
TestWindow()
{
ContentContainer.Controls.Add(
new
UpdatePanel() { ID =
"test"
});
VisibleOnPageLoad =
true
;
Width = 150;
Height = 150;
}
}
}
}