onResponseEnd, I m calling window.open, in the opened page, I m trying to perform on response stream object BinaryWrite to open a excel file. But it is not able to open the file from there.
When I used window.open directly and it worked with out any hassle.
How can I overcome this situation.
Requesting page
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
<ClientEvents OnResponseEnd="onResponseEnd" />
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
function onResponseEnd() {
window.open(g_Url, "", g_SPopUpValues);
}
Requested page
protected void Page_Load(object sender, EventArgs e) {
FileStream MyFileStream;
long FileSize;
MyFileStream = new FileStream(@"c:\test.xls", FileMode.Open);
FileSize = MyFileStream.Length;
byte[] Buffer = new byte[(int)FileSize];
MyFileStream.Read(Buffer, 0, (int)FileSize);
MyFileStream.Close();
Response.AddHeader("content-disposition", "attachment;filename=a.xls");
Response.ContentType = "application/vnd.ms-excel";
Response.BinaryWrite(Buffer);
}
When I used window.open directly and it worked with out any hassle.
How can I overcome this situation.
Requesting page
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
<ClientEvents OnResponseEnd="onResponseEnd" />
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
function onResponseEnd() {
window.open(g_Url, "", g_SPopUpValues);
}
Requested page
protected void Page_Load(object sender, EventArgs e) {
FileStream MyFileStream;
long FileSize;
MyFileStream = new FileStream(@"c:\test.xls", FileMode.Open);
FileSize = MyFileStream.Length;
byte[] Buffer = new byte[(int)FileSize];
MyFileStream.Read(Buffer, 0, (int)FileSize);
MyFileStream.Close();
Response.AddHeader("content-disposition", "attachment;filename=a.xls");
Response.ContentType = "application/vnd.ms-excel";
Response.BinaryWrite(Buffer);
}