Hi
I am following the following example to display an aspx page in popup radwindow.
http://demos.telerik.com/aspnet-ajax/window/examples/dialogreturnvalue/defaultcs.aspx
My code to display radwindow is given below at the end and is the equivalent of Dialog1.aspx in the above example. The code works fine and the content of the below aspx page opens fine in radwindow. Problem is when I click on the ‘I Accept’ button to close the radwindow and return the values to calling page (not included here) the radwindow closes but then reappears immediately. In other words the radwindow cannot be closed permanently using the ‘I Accept’ button. What is the problem and how can I make it work like the example in above link where pressing Submit button in dialog1.aspx closes the radwindow and returns values to calling form?
Many Thanks
Regards
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ViewDocument.aspx.cs" Inherits="SitefinityWebApp.Widgets.TestWidgets.ViewDocument" %>
<!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
style
=
"margin: 0px"
onload
=
"AdjustRadWidow();"
>
<
form
id
=
"form1"
runat
=
"server"
>
<
asp:ScriptManager
ID
=
"ScriptManager1"
runat
=
"server"
>
</
asp:ScriptManager
>
<
telerik:RadFormDecorator
ID
=
"RadFormDecorator1"
DecoratedControls
=
"All"
runat
=
"server"
Skin
=
"Sunset"
/>
<
script
type
=
"text/javascript"
>
function GetRadWindow() {
var oWindow = null;
if (window.radWindow) oWindow = window.radWindow;
else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
return oWindow;
}
function openWin2() {
var parentPage = GetRadWindow().BrowserWindow;
var parentRadWindowManager = parentPage.GetRadWindowManager();
var oWnd2 = parentRadWindowManager.open("Dialog2.aspx", "RadWindow2");
window.setTimeout(function () {
oWnd2.setActive(true);
}, 0);
}
function populateCityName(arg) {
var cityName = document.getElementById("cityName");
cityName.value = arg;
}
function AdjustRadWidow() {
var oWindow = GetRadWindow();
setTimeout(function () { oWindow.autoSize(true); if ($telerik.isChrome || $telerik.isSafari) ChromeSafariFix(oWindow); }, 500);
}
//fix for Chrome/Safari due to absolute positioned popup not counted as part of the content page layout
function ChromeSafariFix(oWindow) {
var iframe = oWindow.get_contentFrame();
var body = iframe.contentWindow.document.body;
setTimeout(function () {
var height = body.scrollHeight;
var width = body.scrollWidth;
var iframeBounds = $telerik.getBounds(iframe);
var heightDelta = height - iframeBounds.height;
var widthDelta = width - iframeBounds.width;
if (heightDelta > 0) oWindow.set_height(oWindow.get_height() + heightDelta);
if (widthDelta > 0) oWindow.set_width(oWindow.get_width() + widthDelta);
oWindow.center();
}, 310);
}
function returnToParent() {
//create the argument that will be returned to the parent page
var oArg = new Object();
oArg.cityName = "London";
oArg.selDate = toLocaleString();
//get a reference to the current RadWindow
var oWnd = GetRadWindow();
//Close the RadWindow and send the argument to the parent page
if (oArg.selDate && oArg.cityName) {
oWnd.close(oArg);
}
else {
alert("Please fill both fields");
}
}
</
script
>
<
div
>
<
asp:Panel
ID
=
"Panel1"
runat
=
"server"
Height
=
"100%"
Width
=
"100%"
>
<
table
style
=
"width: 100%; height: 100%;"
>
<
tr
>
<
td
colspan
=
"3"
>
<
asp:Literal
ID
=
"Literal1"
runat
=
"server"
></
asp:Literal
>
</
td
>
</
tr
>
<
tr
>
<
td
colspan
=
"3"
>
</
td
>
</
tr
>
<
tr
>
<
td
align
=
"center"
width
=
"40%"
>
</
td
>
<
td
align
=
"center"
width
=
"10%"
style
=
"width: 20%"
>
<
button
title
=
"I Accept"
id
=
"close"
onclick
=
"returnToParent(); return true;"
>
I Accept</
button
>
</
td
>
</
tr
>
</
table
>
</
asp:Panel
>
</
div
>
</
form
>
</
body
>
</
html
>