RadWindow won't close

3 posts, 1 answers
  1. Tri Nguyen
    Tri Nguyen avatar
    40 posts
    Member since:
    Feb 2004

    Posted 02 Oct 2014 Link to this post

    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. Answer
    Marin Bratanov
    Admin
    Marin Bratanov avatar
    3595 posts

    Posted 03 Oct 2014 Link to this post

    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.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Tri Nguyen
    Tri Nguyen avatar
    40 posts
    Member since:
    Feb 2004

    Posted 03 Oct 2014 in reply to Marin Bratanov Link to this post

    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
Back to Top