DB_Fury
asked on
create C# method from code
i want to make the following code into its own method so i can use it multiple times. can someone show me how to do that?
ReportViewer rview = new ReportViewer();
rview.ServerReport.ReportServerUrl = new Uri(WebConfigurationManager.AppSettings["ReportServer"]);
List<ReportParameter> paramList = new List<ReportParameter>();
paramList.Add(new ReportParameter("FacilityID", Globals.FacilityID.ToString()));
rview.ServerReport.ReportServerCredentials = new ReportCredentials("xxxx", "xxxx", "xxxx");
rview.ServerReport.ReportPath = "/BoardAssessment/AssessmentReport";
rview.ServerReport.SetParameters(paramList);
string mimeType, encoding, extension, deviceInfo;
deviceInfo = "<DeviceInfo>" + "<SimplePageHeaders>True</SimplePageHeaders>" + "</DeviceInfo>";
string[] streamids;
Warning[] warnings;
byte[] bytes = rview.ServerReport.Render("Excel", deviceInfo, out mimeType, out encoding, out extension, out streamids, out warnings);
Response.ContentType = "application/Excel";
Response.AddHeader("Content-disposition", "attachment;filename=BoardAssessment.xls");
Response.OutputStream.Write(bytes, 0, bytes.Length);
Response.OutputStream.Flush();
Response.OutputStream.Close();
Response.Flush();
Response.Close();
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER