I'm facing an issue with the RadWindow control. If you attempt to drag the window during a postback and the server-side code attempts to close the window via script, the window closes and then re-appears. When the window re-appears, you are not able to close this window using the "X" icon.
Telerik Version: 2011.1.413.40.
Steps to Reproduce:
1. Click "Open Dialog" button.
2. Click "Submit" button in the window. This issues a Thread.Sleep(5000) in the Submit button click event to simulate a long-running task.
3. While the window is posting-back, drag the window around.
4. The window will close, via script from the server-side postback using ScriptManager.RegisterStartupScript to close the window using javascript similar to: "var radWindow = GetRadWindow(); radWindow.close();".
5. Observe that the window re-appears.
6. Now, attempt to close the window. You cannot close this dialog.
Default.aspx Code
Dialog.aspx
Dialog.aspx.cs
scripts.js
Telerik Version: 2011.1.413.40.
Steps to Reproduce:
1. Click "Open Dialog" button.
2. Click "Submit" button in the window. This issues a Thread.Sleep(5000) in the Submit button click event to simulate a long-running task.
3. While the window is posting-back, drag the window around.
4. The window will close, via script from the server-side postback using ScriptManager.RegisterStartupScript to close the window using javascript similar to: "var radWindow = GetRadWindow(); radWindow.close();".
5. Observe that the window re-appears.
6. Now, attempt to close the window. You cannot close this dialog.
Default.aspx Code
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Default" %>
<!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
>
<
telerik:RadStyleSheetManager
id
=
"RadStyleSheetManager1"
runat
=
"server"
/>
<
script
src
=
"scripts.js"
type
=
"text/javascript"
></
script
>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
telerik:RadScriptManager
ID
=
"RadScriptManager1"
runat
=
"server"
>
<
Scripts
>
<%--Needed for JavaScript IntelliSense in VS2010--%>
<%--For VS2008 replace RadScriptManager with ScriptManager--%>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.Core.js"
/>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.jQuery.js"
/>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.jQueryInclude.js"
/>
</
Scripts
>
</
telerik:RadScriptManager
>
<
script
type
=
"text/javascript"
>
//Put your JavaScript code here.
</
script
>
<
telerik:RadWindowManager
ID
=
"WindowManager"
runat
=
"server"
Behaviors
=
"Move,Close,Resize"
DestroyOnClose
=
"true"
KeepInScreenBounds
=
"true"
Modal
=
"true"
ReloadOnShow
=
"true"
ShowContentDuringLoad
=
"false"
VisibleStatusbar
=
"false"
>
<
Windows
>
<
telerik:RadWindow
ID
=
"DialogWindow"
OpenerElementID
=
"OpenDialogButton"
NavigateUrl
=
"Dialog.aspx"
runat
=
"server"
Width
=
"650px"
Height
=
"450px"
>
</
telerik:RadWindow
>
</
Windows
>
</
telerik:RadWindowManager
>
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
>
</
telerik:RadAjaxManager
>
<
div
>
<
h1
>Test Window Drag Issue</
h1
>
<
ol
>
<
li
>1. Click "Open Dialog".</
li
>
<
li
>2. Click "Submit" button in the window. This issues a Thread.Sleep(5000) to simulate a long-running task.</
li
>
<
li
>3. While the window is posting-back, drag the window around.</
li
>
<
li
>4. The window will close, via script from the server-side postback. And then the window will re-appear.</
li
>
<
li
>5. Now, attempt to close the window. You cannot close this dialog.</
li
>
</
ol
>
<
p
>Click "Open Dialog" button.</
p
>
<
asp:Button
ID
=
"OpenDialogButton"
runat
=
"server"
Text
=
"Open Dialog"
/>
</
div
>
</
form
>
</
body
>
</
html
>
Dialog.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Dialog.aspx.cs" Inherits="RadControls_WindowIssue.Dialog" %>
<!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
>
<
script
src
=
"scripts.js"
type
=
"text/javascript"
></
script
>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
telerik:RadScriptManager
ID
=
"RadScriptManager2"
runat
=
"server"
>
</
telerik:RadScriptManager
>
<
telerik:RadAjaxPanel
id
=
"AjaxPanel1"
LoadingPanelID
=
"LoadingPanel1"
runat
=
"server"
>
<
h1
>Dialog Page</
h1
>
<
p
>A sample dialog to illustrate the issue.</
p
>
<
ol
>
<
li
>1. Click the Submit button.</
li
>
<
li
>2. The postback event has a Thread.Sleep(5000) - 5 seconds. Then, the server-side code issues a close window script.</
li
>
<
li
>3. While the page is in the middle of a post-back, drag the Window.</
li
>
<
li
>4. Observe that when the window closes, it opens back up and is visible. However, now you cannot close the dialog.</
li
>
</
ol
>
<
asp:Button
id
=
"SubmitButton"
runat
=
"server"
Text
=
"Submit"
OnClick
=
"SubmitClick"
/>
</
telerik:RadAjaxPanel
>
<
telerik:RadAjaxLoadingPanel
ID
=
"LoadingPanel1"
Skin
=
"Default"
runat
=
"server"
/>
</
form
>
</
body
>
</
html
>
Dialog.aspx.cs
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Web;
using
System.Web.UI;
using
System.Web.UI.WebControls;
namespace
RadControls_WindowIssue
{
public
partial
class
Dialog : System.Web.UI.Page
{
protected
void
Page_Load(
object
sender, EventArgs e)
{
}
protected
void
SubmitClick(
object
sender, EventArgs e)
{
System.Threading.Thread.Sleep(5000);
ScriptManager.RegisterStartupScript(
this
, GetType(),
"close"
,
"CloseModal();"
,
true
);
}
}
}
scripts.js
function
GetRadWindow() {
var
oWindow =
null
;
if
(window.radWindow)
oWindow = window.radWindow;
else
if
(window.frameElement && window.frameElement.radWindow)
oWindow = window.frameElement.radWindow;
return
oWindow;
}
function
CloseModal() {
var
radWindow = GetRadWindow();
radWindow.close(returnValue);
}