Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Window > close radWindow
RadControls for ASP.NET are no longer supported (see this page for reference). In case you have inquiries about the Telerik ASP.NET AJAX controls, post them in the pertinent ASP.NET AJAX forums.

Not answered close radWindow

Feed from this thread
  • Amanda avatar

    Posted on May 11, 2011 (permalink)

    I have a radWindow that uploads files to a fileserver.  If we upload a file that is over a certain mb - we output an error in the radWindow.  Then when we try to close the window - the window doesn't close.  It works otherwise.

    function GetRadWindow() {
                            var oWindow = null;
                            if (window.radWindow)
                                oWindow = window.radWindow;
                            else if (window.frameElement.radWindow)
                                oWindow = window.frameElement.radWindow;
                            return oWindow;
                        }
                        function CloseOnReload() {
                            alert("Closing the page");
                            GetRadWindow().BrowserWindow.refreshGrid();
                            GetRadWindow().Close();
                        }

    <asp:Button ID="addButton" style="text-decoration:none" CommandName="Close" runat="server" Text="Close" OnClientClick="CloseOnReload()" Width="60px" />

    Thanks,
    Amanda

  • Marin Bratanov Marin Bratanov admin's avatar

    Posted on May 12, 2011 (permalink)

    Hi Amanda,

    I am not sure I understand your scenario correctly, but I assume that the RadWIndow does not close when the button is clicked. If that is the issue please note a few clarifications:

    • The button you use to call the JavaScript function lacks the return false; statement in the OnClientClick event handler and thus it most likely performs a postback (after which the RadWindow might be visible if it has the VisibleOnPageLoad property set to true)
    • The GetRadWindow() method is designed to be used within the RadWindow when an external page is loaded and thus will not return a correct reference if called from the main page. You might need to use, for example, the $find() method to get the desired reference

    That being said - if the above suggestions do not help you resolve your issue please open a support ticket and send us a simple, runnable project that displays this behavior along with detailed reproduction steps. Before we have more information on the exact issue you are experiencing we can do little more than guessing.



    Greetings,
    Marin
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

  • Amanda avatar

    Posted on May 13, 2011 (permalink)

    The code i sent you is in the external page - ie radWindow that was opened.  The radWindow closes except for when an upload fails to upload properly when the size is over 20mb and then you go add another file to the upload.  Then when you push close - it goes back to Attachment size cannot be larger than 20MB in the radWindow.

  • Marin Bratanov Marin Bratanov admin's avatar

    Posted on May 17, 2011 (permalink)

    Hi Amanda,

    At the current state of affairs I can only be guessing, but it looks like the attempted upload that has generated this error is still active (that is the uploading module you are using has not cleared this error) and thus the RadWindow might be reopened or some flag is still raised, this all depends on your custom logic.

    Without you actual code I cannot say what the reason for this behavior is. I suggest that you open a support ticket and send us a sample project along with detailed reproduction steps so that we can debug it locally and pinpoint the cause.



    Best wishes,
    Marin
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

  • Amanda avatar

    Posted on May 17, 2011 (permalink)

    Okay - it isn't only with the upload.

    Open radWindow from edit page.
    Delete upload from radGrid in radWindow.
    Close radWindow.
    Updates the edit page radGrid that holds the upload information
    Repeat:
    Open radWindow from edit page.
    Delete upload from radGrid in radWindow.
    Close radWindow.
    Result:  it closes the radWindow - but does not update the radGrid in the edit page.

    JS parent page:
    function openNewAttWin(ID) {
                    var oWnd1 = radopen("AddAttachment.aspx?ID=" + ID, "RadWindow1");
                    oWnd1.setSize(700, 500);
                    oWnd1.add_close(OnClientClose);
                }
                function CloseOnReload() {
                    $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest();
                }

                function refreshGrid() {
                    var radMgr = $find("<%=RadAjaxManager1.ClientID %>").ajaxRequest("Rebind");
                }

    <telerik:RadWindowManager ID="RadWindowManager1" ShowContentDuringLoad="false" VisibleStatusbar="false"
                            ReloadOnShow="true" runat="server" Skin="Web20" OnClientClose="CloseOnReload" DestroyOnClose="true">
                            <Windows>
                                <telerik:RadWindow ReloadOnShow="false" ID="RadWindow1" VisibleStatusBar="false" OnClientClose="CloseOnReload"
                                    Width="700px" Height="500px" Title="Add Attachment" Behaviors="Close, Move, Resize, Maximize"
                                    runat="server" NavigateUrl="AddAttachment.aspx" Modal="true">
                                </telerik:RadWindow>

    JS radWindow:
    function GetRadWindow() {
                            var oWindow = null;
                            if (window.radWindow)
                                oWindow = window.radWindow;
                            else if (window.frameElement.radWindow)
                                oWindow = window.frameElement.radWindow;
                            return oWindow;
                        }
                        function CloseOnReload() {
                            GetRadWindow().Close();
                            GetRadWindow().BrowserWindow.refreshGrid();
                            
                        }

  • Marin Bratanov Marin Bratanov admin's avatar

    Posted on May 20, 2011 (permalink)

    Hello Amanda,

    Without having your code is is difficult to say what the cause for this issue might be.

    What I can suggest is the following:

    • Clean up the markup so that you add the close handlers, set the size and NavigateUrl only once, because they are currently duplicated in the RadWIndowManager, the RadWindow and in the opener function (and the close handler declared in the markup takes precedence)
    • Try refreshing the grid before you close the RadWindow as it might be disposed by the time the second call to the GetRadWindow() is made and thus it wouldn't find the browser window
    • Please make sure that the correct JavaScript function is called since the names are the same, yet the handlers for the RadWIndow events should be defined in the RadWindow's parent page as this is where the object resides.

    If the above does not help you resolve the issue please send us a simple, runnable project that isolates the case so that we can debug it locally and pinpoint the cause. We do not need your actual database, just some sample data to get it running.



    Best wishes,
    Marin
    the Telerik team

    Consider using RadControls for ASP.NET AJAX (built on top of the ASP.NET AJAX framework) as a replacement for the Telerik ASP.NET Classic controls, See the product support lifecycle here.

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Window > close radWindow