One of the frustrating things about dealing with SQL Reporting Services is the fact that they're hard to use from your own app. There is the ReportViewer control which is handy, but still cumbersome if your users just want to get a quick PDF dump of some list they see on the screen. It turns out, there's an easier way!

I found out that all the ReportViewer does is create a simple IFRAME and most of the work is in constructing the URL.

So on my ASPX page, I put a simple hyperlink control:

<asp:HyperLink id="reportLink" runat="server">Export to PDF</asp:HyperLink>

Then, in my code-behind, I set the NavigateUrl property to the report URL. For example:

string serverRootUrl = "http://localhost/ReportServer";
string reportFolder = "/MyReportFolder/";
string reportName = "SomeSummaryReport";

string rsUrl = String.Format(
"{0}?{1}{2}&YourParamNameHere={3}&rs%3aClearSession=true&"
+ "rs%3aFormat=PDF&rs%3aCommand=Render&rc%3aToolbar=False",
serverRootUrl,
Server.UrlEncode(reportFolder),
Server.UrlEncode(reportName),
Server.UrlEncode(paramValue) );

reportLink.NavigateUrl = rsUrl;

You can add as many parameters as your report takes (by using the "&ParamName=ParamValue" syntax), or you can leave them off entirely if you report requires no parameters.

When the user clicks the link, the PDF will be presented to them (either in-browser, or they will be prompted to download or save the PDF depending on how their Acrobat settings are configured).