RadWindow could not close on download button.

7 posts, 0 answers
  1. Sushobhit
    Sushobhit avatar
    26 posts
    Member since:
    Apr 2011

    Posted 21 Jun 2012 Link to this post

    Hi,

    I have open a RadWindow on a button click event and then in that window i have added a download button for downloading the file.
    But as the download pop up the radwindow stop behaving. Right now i want that RadWindow should get close automatically  when the download gets completed but currently it remains open. So please provide me solution for this.

    Thanks
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 21 Jun 2012 Link to this post

    Hi Sushobhit,

    Try the following code snippet to close the RadWindow.

    ASPX:
    <asp:Button runat="server" ID="btnDownLoad" Text="DownLoad" OnClientClick="CloseDialog();return false;" OnClick="btnDownLoad_Click" />

    JS:
    <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 CloseDialog() {
                GetRadWindow().close();
                __doPostBack("<%=btnDownLoad.UniqueID %>", "");
            }
    </script>

    Hope this helps.

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Sushobhit
    Sushobhit avatar
    26 posts
    Member since:
    Apr 2011

    Posted 21 Jun 2012 Link to this post

    Hi Princy

    Thanks for your reply.
    but after using this onclientclick on Download button the radwindow gets close before the download begins.
    Please tell me any other solution so that user can download and radwindow gets close after that.

    Thanks
  5. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3599 posts

    Posted 22 Jun 2012 Link to this post

    Hello,

    There simply isn't a browser event that you can hook to when the download finishes, begins, or is ongoing. This means there isn't an event that you can use to close the RadWIndow (or a regular browser window, for that matter) when the download is done. What you can do is to redirect the main page and not send the file as an inline attachement as this makes it more probable that the browser will display the download prompt in the same window without opening a new one (either a RadWIndow or browser window).


    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.
  6. Sushobhit
    Sushobhit avatar
    26 posts
    Member since:
    Apr 2011

    Posted 14 Aug 2012 Link to this post

    Hi Princy

     Thanks of lot i have fixed the problem with your code and some modification . 

  7. Amruta
    Amruta avatar
    18 posts
    Member since:
    Apr 2009

    Posted 20 May 2015 Link to this post

    Hi Sushobhit,

    Can you please post your code for the same. I have same kind of requirement.

    Thanks.

     

  8. Logan
    Logan avatar
    23 posts
    Member since:
    Jan 2012

    Posted 30 Sep in reply to Sushobhit Link to this post

    Still having this issue, any thoughts?
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017