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

RadWindow could not close on download button.

6 Answers 84 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Sushobhit
Top achievements
Rank 2
Sushobhit asked on 21 Jun 2012, 08:56 AM
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

6 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 21 Jun 2012, 09:29 AM
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.
0
Sushobhit
Top achievements
Rank 2
answered on 21 Jun 2012, 10:46 AM
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
0
Marin Bratanov
Telerik team
answered on 22 Jun 2012, 10:38 AM
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.
0
Sushobhit
Top achievements
Rank 2
answered on 14 Aug 2012, 06:36 AM
Hi Princy

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

0
Amruta
Top achievements
Rank 1
answered on 20 May 2015, 10:28 AM

Hi Sushobhit,

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

Thanks.

 

0
Logan
Top achievements
Rank 1
answered on 30 Sep 2016, 06:55 PM
Still having this issue, any thoughts?
Tags
General Discussions
Asked by
Sushobhit
Top achievements
Rank 2
Answers by
Princy
Top achievements
Rank 1
Sushobhit
Top achievements
Rank 2
Marin Bratanov
Telerik team
Amruta
Top achievements
Rank 1
Logan
Top achievements
Rank 1
Share this question
or