2

In an aspx page I have a ReportViewer set up like this:

 <rsweb:ReportViewer ID="rvReport" runat="server" ShowPromptAreaButton="false" ProcessingMode="Remote" AsyncRendering="false" SizeToReportContent="true" ShowToolBar="true" CssClass="reportViewer">
    <ServerReport ReportPath="/<ReplaceMe>/Reports/report1" />
</rsweb:ReportViewer>

What I'd like to do is be able to specify the value of <ReplaceMe> with a value from the app settings section of my web.config.

Something like

<appsettings>
    <add key="ReportPathFolder" value="FOLDER1"/>
</appsettings>

I've tried this:

<ServerReport ReportPath="/<%$ AppSettings:ReportPathFolder %>/Reports/report1" />

But it doesn't work. I get a path is invalid error.

criticalfix
  • 2,870
  • 1
  • 19
  • 32
Jason Massey
  • 1,088
  • 10
  • 18

1 Answers1

1

You could do this from your code behind page, as described here: how to open ssrs report from asp web page using report viewer

So you would pull "ReplaceMe" out of your AppSettings, and your code would look something like this:

ServerReport serverReport = reportViewer.ServerReport;
serverReport.ReportServerUrl = new Uri("http://<Server Name>/reportserver");
serverReport.ReportPath = ="/<ReplaceMe>/Reports/report1";
Community
  • 1
  • 1
criticalfix
  • 2,870
  • 1
  • 19
  • 32
  • That's what I've got in place right now on one test page. And it works great. I'm looking for a solution using the .aspx page directly since I can right a simple find->replace and point it to the 50 or so pages that have reports. – Jason Massey Sep 03 '14 at 17:42
  • Okay, I'm not sure how to do it that way, either. – criticalfix Sep 03 '14 at 18:15