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

RadWindow won't close

2 Answers 55 Views
Window
This is a migrated thread and some comments may be shown as answers.
Tri Nguyen
Top achievements
Rank 1
Tri Nguyen asked on 02 Oct 2014, 10:12 PM
Hello,

I have created a simple example, to utilize the loading panel on a RadWindow. On my current apps, when I called EditCancel(), the RadWindow closed properly. But not on this example. I am sure it's probably just some simple setting that I forgot. I just couldn't figure it out which one. Could you help?

Thanks in advance.

Tri

Master Page:

<%@ Master Language="VB" CodeFile="MasterPage.master.vb" Inherits="MasterPage" %>

<!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">Header
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">

</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>

Main Page:

<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="PgMain.aspx.vb" Inherits="PgMain" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
</telerik:RadScriptManager>
<telerik:RadCodeBlock ID="rcb1" runat="server">
<script language="javascript" type="text/javascript">
function ShowEditForm(pageUrl, id, iWidth, iHeight) {
var nWindow = window.radopen(pageUrl + ".aspx?id=" + id, "UserListDialog");
nWindow.setSize(iWidth, iHeight);
nWindow.center();
nWindow.modal = true;
nWindow.set_behaviors(Telerik.Web.UI.WindowBehaviors.Resize + Telerik.Web.UI.WindowBehaviors.Move + Telerik.Web.UI.WindowBehaviors.Close);
nWindow.show();
return false;
}
</script>
</telerik:RadCodeBlock>
<div>
<asp:Button ID="lbn" runat="server" Text="Load Window" OnClientClick="return ShowEditForm('PgWindow', 0, 500, 500);" />
</div>
<telerik:RadWindowManager ID="WinMgr" runat="server" Skin="WebBlue" KeepInScreenBounds="true"
Style="z-index: 7100;">
<Windows>
<telerik:RadWindow ID="UserListDialog" runat="server" Behaviors="Close, Move" Height="300px"
Left="10px" Modal="true" ReloadOnShow="true" Skin="WebBlue" Opacity="100" Title="User List Dialog"
Top="10px" Width="500px" KeepInScreenBounds="true">
</telerik:RadWindow>
</Windows>
</telerik:RadWindowManager>
</asp:Content>

Window Page:

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="PgWindow.aspx.vb" Inherits="PgWindow" %>

<!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">
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
</telerik:RadScriptManager>
<telerik:RadCodeBlock ID="rcb1" runat="server">
<script type="text/javascript">
function GetRadWindow() {
var oWindow = null;
if (window.radWindow) oWindow = window.radWindow; //Will work in Moz in all cases, including clasic dialog
else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow; //IE (and Moz as well)
return oWindow;
}

function CancelEdit() {
alert('Should be closing!');
GetRadWindow().Close();
}

</script>
</telerik:RadCodeBlock>
<div>
<asp:Panel ID="pnl" runat="server" Height="400">
Just testing
</asp:Panel>
<asp:Button ID="btnClose" runat="server" Text="Process ..." />
</div>
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="WebBlue">
</telerik:RadAjaxLoadingPanel>
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="btnClose">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="pnl" UpdatePanelCssClass="" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
</form>
</body>
</html>



2 Answers, 1 is accepted

Sort by
0
Accepted
Marin Bratanov
Telerik team
answered on 03 Oct 2014, 08:39 AM

Hi Tri,

As long as the CancelEdit function is called, the RadWindow should close. I am attaching here a small sample I build on your snippets that seems to work fine on my end.

Since I am not sure how you call the function I added a button for it. If you are registering it from the server, examine this article: http://www.telerik.com/help/aspnet-ajax/window-troubleshooting-javascript-from-server-side.html. Note that if the script registration happens during a partial postback you should use the ScriptManager.RegisterStartupScript() method and not the ClientScript class.


Regards,

Marin Bratanov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Tri Nguyen
Top achievements
Rank 1
answered on 03 Oct 2014, 05:10 PM
Thanks for your quick response. Changing to ScriptManager seems to take care of the problem in my example. Not so successful with my apps. I'll look more into it.

Again, thanks.

Tri
Tags
Window
Asked by
Tri Nguyen
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Tri Nguyen
Top achievements
Rank 1
Share this question
or