Jim Rogers

Lives in Baton Rouge, LA, with two dogs, one cat, and one lovely wife. I'm a lead developer for GCR & Associates.

Katrin and Jim

Month List

Setting export file name in SSRS report viewer

by jim Apr 27, 2010 9:55 AM

export 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.

Tags:

Code

Comments (2) -

1/31/2011 5:41:01 PM #

Rich

Jim, can this be accomplished in the custom code tab of the report properties?

Rich United States

9/23/2011 7:30:18 AM #

Samantha Fox

Nice information.....thanks

Samantha Fox United States

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading