Hello Friends.
am using Visual Studio 2010. and SSRS Reports with Report Viewer and i have afuctionality like export into PDF or Excel. when and using ajax update panel am getting below error.
"Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.
Details: Error parsing near '%PDF-1.3
1 0 obj
['."
my CS code sample:
ReportViewer1.ShowCredentialPrompts = true;
ReportViewer1.ServerReport.ReportServerCredentials = new ReportServerNetworkCredentials();
ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;
ReportViewer1.ServerReport.ReportServerUrl = new System.Uri(Convert.ToString(Session["REP_SERVER_URL"]));
ReportViewer1.ServerReport.ReportPath = Convert.ToString(Session["REP_SERVER_RPT_PATH"]) + "/OP_REPORTS/" + ReportName;
ReportViewer1.ServerReport.SetParameters(pr);
ReportViewer1.ServerReport.Refresh();
ExportReport();
private void ExportReport()
{
Byte[] bytes = null;
string encoding;
string mimeType = string.Empty;
Warning[] warnings = null;
string extension = string.Empty;
string[] streamIDs = null;
if (ExportTypeDdl.SelectedIndex == 1)
{
bytes = ReportViewer1.ServerReport.Render("Excel", Convert.ToString(ViewState["DeviceInfo"]), out mimeType, out encoding, out extension, out streamIDs, out warnings);
}
else
{
bytes = ReportViewer1.ServerReport.Render("pdf", Convert.ToString(ViewState["DeviceInfo"]), out mimeType, out encoding, out extension, out streamIDs, out warnings);
}
Response.Buffer = true;
Response.Clear();
Response.ContentType = mimeType;
if (ReportNameDDl.SelectedIndex == 1)
{
Response.AddHeader("content-disposition", "attachment; filename=" + "Acknowledgement_Slip" + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year + "-" + DateTime.Now.ToShortTimeString() + "." + extension);
}
else
{
Response.AddHeader("content-disposition", "attachment; filename=" + "Loan_Schedule" + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year + "-" + DateTime.Now.ToShortTimeString() + "." + extension);
}
Response.BinaryWrite(bytes);
Response.Flush();
}