Hi,
I use RadWindow throughout my application.
I typically close the window in code behind using winPDF.VisibleOnPageLoad = false; and this works just fine.
However, if I'm using the following code to cause a file to be downloaded to the client, then the RadWindow remains open:
Placing the last line above before the Response. statements has no effect.
I have tried adding OnClientClicked="closePDF();return false;" to the RadButton on the RadWindow that performs the export, but that results in an error since the function can't seem to find the window. My idea was to cause the window to close and then the postback to occur to cause the above code behind to fire. Here's the relevant code in my aspx page:
When the application is run, the "window" variable in the above function is null.
If I remove the OnClientClicked event from the RadButton, I get no errors, but the RadWindow will not close.
Any ideas?
Thanks in advance
Jim
I use RadWindow throughout my application.
I typically close the window in code behind using winPDF.VisibleOnPageLoad = false; and this works just fine.
However, if I'm using the following code to cause a file to be downloaded to the client, then the RadWindow remains open:
Response.ContentType = "application/pdf";
Response.AppendHeader("Content-Disposition", "attachment; filename=\"" + fullfilename + "\"");
Response.TransmitFile(fullfilename);
winPDF.VisibleOnPageLoad = false; // Close the RadWindow
Placing the last line above before the Response. statements has no effect.
I have tried adding OnClientClicked="closePDF();return false;" to the RadButton on the RadWindow that performs the export, but that results in an error since the function can't seem to find the window. My idea was to cause the window to close and then the postback to occur to cause the above code behind to fire. Here's the relevant code in my aspx page:
function closePDF() {
var window = $find("ctl00_ContentPlaceHolder_winPDF");
window.close();
}
<
telerik:RadWindow
ID
=
"winPDF"
Width
=
"300px"
Height
=
"240px"
runat
=
"server"
Title
=
"Export to PDF"
Style
=
"z-index: 999999"
VisibleOnPageLoad
=
"false"
Behaviors
=
"Move"
EnableShadow
=
"true"
Modal
=
"true"
OnClientClose
=
"OnClientClose"
>
<
ContentTemplate
>
<
div
style
=
"padding: 5px;"
>
<
telerik:RadButton
ID
=
"btnEx2PDF"
OnClick
=
"Export2PDF"
CommandName
=
"Export"
Text
=
"Export"
OnClientClicked
=
"closePDF();return false;"
runat
=
"server"
>
</
telerik:RadButton
>
<
telerik:RadButton
ID
=
"btnCancel"
OnClick
=
"Export2PDF"
CommandName
=
"Cancel"
Text
=
"Cancel"
CausesValidation
=
"false"
runat
=
"server"
>
</
telerik:RadButton
>
</
div
>
...
When the application is run, the "window" variable in the above function is null.
If I remove the OnClientClicked event from the RadButton, I get no errors, but the RadWindow will not close.
Any ideas?
Thanks in advance
Jim