OnClientClose of RadWindowManager Ignored

4 posts, 1 answers
  1. Brian
    Brian avatar
    68 posts
    Member since:
    Jun 2011

    Posted 08 Aug 2012 Link to this post

    Hello,

    I have Explorer.aspx that defines a RadWindowManager as seen below:

    <telerik:RadWindowManager ID="radWinMgr" runat="server" AutoSize="true" EnableShadow="true" ReloadOnShow="true" ShowContentDuringLoad="false" VisibleStatusbar="false"  OnClientClose="fncClientClose">
        <Windows>
            <telerik:RadWindow ID="rwUploadParent" runat="server" Behaviors="Close" NavigateUrl="Upload.aspx"></telerik:RadWindow>
            <telerik:RadWindow ID="rwDownloadParent" runat="server" Behaviors="Close" NavigateUrl="Download.aspx"></telerik:RadWindow>
        </Windows>
    </telerik:RadWindowManager>

     

    The OnClientClose function that you see referenced above is defined as follows:

    <script type="text/javascript">
        function fncClientClose(winNewRep, args) {
            var arg = args.get_argument();
     
            if (arg == 1) {
                //Refresh file explorer:
                var oExplorer = $find("<%=radExplorer.ClientID%>");
                var dirPath = oExplorer.get_currentDirectory();
     
                if (dirPath) oAjaxPanel.ajaxRequest(dirPath);
            }
        }
    </script>

     

    The purpose of the function is to refresh the RadFileExplorer, but this function never gets called. I have a button click the opens Upload.aspx as a RadWindow as follows:

    <asp:Button ID="btnUpload" runat="server" Text="Upload" OnClientClick="fncOpenPopupWin('UploadMgr.aspx?UpFolder=', 'rwUploadParent'); return false;" />

     

    As you see the OnClientClick of the button calls another function and passes the page name to open, including a query string parameter, and the name of the RadWindow:

    <script type="text/javascript">
        function fncOpenPopupWin2(strPage, strParent) {
            var varLocation = "/Root";
            var winNewRep = radopen(strPage + varLocation, strParent);
        }
    </script>

     

    When the button is clicked, page Upload.aspx opens, the user does what he/she wants, and then closes Upload.aspx. At that point, I expect the OnClientClose of the RadWindownManager to execute, but it never does.

    I have read many postings about this kind of problem here on the forum, but none of the solutions have helped my situation. I appreciate any time someone takes to review this and offer suggestions.

     

    Thank you,

    Steven

  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3602 posts

    Posted 10 Aug 2012 Link to this post

    Hello Steven,

    Have you gone through the following help article: http://www.telerik.com/help/aspnet-ajax/window-troubleshooting-wrong-window-opened.html? If this is not the case - do you have the AjaxControlToolkit in the Bin folder and if so - what happens if  you remove it? Also, have you examined your page for JavaScript errors and does resolving them help, if there are any? What I also notice in your snippets is that the button's click calls fncOpenPopupWin() while you have pasted a function fncOpenPopupWin2(strPage, strParent) so the difference may be coming from a different piece of code there.


    All the best,
    Marin Bratanov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Brian
    Brian avatar
    68 posts
    Member since:
    Jun 2011

    Posted 10 Aug 2012 Link to this post

    Marin,

     

    Thank you for your response.

     

    I had not read the article that you provided, but I have now. It discusses the issues of having more than one RadWindowManager in a page. I had already read about this in other forum postings that discussed the same problem that I am having. I went through the Opening Windows documentation as well.

     

    I originally had 2 RadWindowManager in my page, one for each RadWindow, I moved my 2 RadWindow into one RadWindowManager, leaving me with only 1 RadWindowManager.

     

    I am not utilizing a master page within my project, so that should rule out any possible issue of another RadWindowManager. When I go to Edit > Find within Visual Studio to search through my ASPX and look for instances of RadWindowManager, I only find one instance. But when I load the same page into my web browser and then right-click > View Source, the source shows 2 instances of RadWindowManager, as follows:

     

    Sys.Application.add_init(function() {

        $create(Telerik.Web.UI.RadWindowManager, {"autoSize":true,"clientStateFieldID":"radWinMgr_ClientState","enableShadow":true,"formID":"frmFileExplorer","iconUrl":"","minimizeIconUrl":"","name":"radWinMgr","reloadOnShow":true,"showContentDuringLoad":false,"skin":"Windows7","visibleStatusbar":false,"windowControls":"['rwUploadParent','rwDownloadParent']"}, {"close":fncClientClose}, {"child":"rwUploadParent"}, $get("radWinMgr"));

    });

    Sys.Application.add_init(function() {

        $create(Telerik.Web.UI.RadWindowManager, {"behaviors":36,"clientStateFieldID":"radFileExplor_windowManager_ClientState","enableAriaSupport":true,"formID":"frmFileExplorer","height":"340px","iconUrl":"","minimizeIconUrl":"","modal":true,"name":"windowManager","shortcuts":"[[\u0027close\u0027,\u0027Esc\u0027]]","skin":"Office2010Blue","title":"Upload","visibleStatusbar":false,"width":"451px","windowControls":"[]"}, null, null, $get("radFileExplor_windowManager"));

    });

     

    I have no clue as to why it shows a second RadWindowManager for radFileExplor (this is the ID that I assigned to my RadFileExplorer control). Could this be the reason why my OnClientClose is not executing when I close my RadWindow? The first RadWindowManager (radWinMgr) is the only one I see when I am in design view of Visual Studio. If this second RadWindowManager is the cause of my problem, how do I resolve this problem, since I don’t see this second RadWindowManager while in design view of Visual Studio? As I have mentioned, I am not using a master page within the project.

     

    Thank you,

    Steven

     

    BTW, the fncOpenPopupWin2 that I mention in my initial post is basically a typo. Throughout my project, it is simply fncOpenPopupWin.

  5. Answer
    Marin Bratanov
    Admin
    Marin Bratanov avatar
    3602 posts

    Posted 13 Aug 2012 Link to this post

    Hello Steven,

    The RadFileExplorer uses a RadWindowManager internally and this is why it is present in the page source. This is why I advised that you examine it so see the order in which they are created. The article I linked also offers the way to solve the case - by using $find(desiredManagerClientID).open() instead of just radopen():
    var winNewRep = $find("<%=radWinMgr.ClientID %>").open(strPage + varLocation, strParent);

    in fncOpenPopupWin().

    Kind regards,
    Marin Bratanov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top