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

radwindow with download button

3 Answers 201 Views
Window
This is a migrated thread and some comments may be shown as answers.
JJ
Top achievements
Rank 1
JJ asked on 01 Feb 2012, 12:40 AM
I have a RadWindow, has a download button, on the download button

On download_click does below.

Response.AddHeader("Content-Disposition", "attachment;filename=" + MyFileInfo.FullName);
  
Response.WriteFile(FullPath, StartPos, FileSize);
  
Response.End();

Then pop up the window download screen, you can click save or open, if I click "save", it downloads file perfectly. If I click "Open", the file displays in the html parent window instead of the Radwindow. If there anyway that the "Open" displays html in the Radwindow instead of the parent window?

Thanks!

3 Answers, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 01 Feb 2012, 05:05 PM
Hello JJ,

Are you using the ContentTemplate of the RadWindow? If so - this button is a part of the main page and this means that this behavior is correct. In case you are using the NavigateUrl to open a new page it should work as expected, as it has its own window object (it is loaded in an iframe) and its Response object is different than the parent page's. This means that it behaves like an iframe if an external page is loaded and like a regular Panel if the ContentTemplate is used. I hope this information will help you decide how you can proceed.

I tried reptoducing this behavior, yet on my end things were working as expected: http://screencast.com/t/IDVC7bReEC. I am also attaching my test pages as a reference here. Please also note that how the browser opens a file largely depends on the user's settings and cannot always be controlled by the developer. You will notice that my browser, for example, opens a new tab.


Greetings,
Marin
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
JJ
Top achievements
Rank 1
answered on 01 Feb 2012, 10:22 PM
Thanks for the example. I see what is the difference between your sample and mine. I used NavigateURL with Radwindow manager. If you use a text file with no extention instead of flower.gif in your attached example, you will see what I am talking about - the text file will displayed on the parent browser window.

 

0
Marin Bratanov
Telerik team
answered on 02 Feb 2012, 05:36 PM
Hello JJ,

I tried removing the file extension and, as expected, the browser did not know what the file was and therefore what to do with it: http://screencast.com/t/WBwmUo2GadAq. Once I returned it to .txt the default browser action was triggered (which, on my PC, is opening via Notepad).

What I can suggest at this point is that you replace the RadWindow with a regular iframe, as this is what it is essentially. If you get the same behavior then this means that this is the way your browser works and this is not up to the developer to control but to the browser settings.

Once you get the desired behavior with a simple iframe the same approach should work for the RadWindow as well. In case you get different behavior between a RadWindow and a regular iframe please open a support ticket and send us a runnable sample that shows this difference. You can use my pages as base - what is needed is that it is runnable and that it reliably reproduces the issue at hand.


Kind regards,
Marin
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
Tags
Window
Asked by
JJ
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
JJ
Top achievements
Rank 1
Share this question
or