Hello Bhushanam,
Even i have got the same problem. I solved the problem by overriding render method with the following code.
put below code in button click event
private void lnkexport_Click(object sender, System.EventArgs e)
{
ReportingService rs = new ReportingService();
string reportPath=/SampleDetail/TestingDetail;
// TestingDetail report must uploded in SampleDetail folder in ReportManager
TestingDetailReport testingDetailParams =this.reportParams as TestingDetailReport;
ParameterValue[] parameters = new ParameterValue[1];
parameters[0] = new ParameterValue();
parameters[0].Name="parameterName";
parameters[0].Value=parameterValue;
Byte[] result = this.LoadReport(reportPath,parameters);
string fname = "TestingDetail" + " - " +DateTime.Today.ToString("MMMM-dd-yyyy");
Response.ClearContent();
Response.AddHeader("Content-Disposition","attachment; filename=" + fname);
Response.AddHeader("Content-Length", result.LongLength.ToString());
Response.ContentType="Application/pdf";
Response.BinaryWrite(result);
Response.Flush();
Response.Close();
}
private Byte[] LoadReport(string reportPath,ParameterValue[] parameter )
{
ReportingService rs = new ReportingService();
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
string[] streamIDs;
string optionalString = null;
ParameterValue[]optionalparams =null;
Warning[] warning = null;
Byte[] output= rs.Render(reportPath,"PDF",null,null,parameter,nul l,null,out optionalString,out optionalString,out optionalparams,out warning,out streamIDs);
return output;
}
|