by jim
Apr 27, 2010 9:55 AM
If you’re using the Sql Server Reporting Services ReportViewer control, specifying the export filename is simple, if not immediately obvious.
In your Page_Load - or wherever appropriate:
DateTime startDate = DateTime.Parse(Request.Params["start"]);
DateTime endDate = DateTime.Parse(Request.Params["end"]);
string filename = string.Format(
"PerDiem {0:yyyyMMdd} to {1:yyyyMMdd}", startDate, endDate);
ReportViewer1.LocalReport.DisplayName = filename;
The DisplayName is used as the export file’s name, with an extension depending on the export type.