Apr 20, 2016

SSRS server mode how to open ssrs report from asp web page using report viewer


down voteaccepted
You need to separate out the URL to the server, report path and add the parameters to a parameters array.
Here's a sample:
    protected void Page_Init(object sender, EventArgs e)
{
    if (!Page.IsPostBack)
    {
        // Set the processing mode for the ReportViewer to Remote
        reportViewer.ProcessingMode = ProcessingMode.Remote;

        ServerReport serverReport = reportViewer.ServerReport;

        // Set the report server URL and report path
        serverReport.ReportServerUrl =
            new Uri("http://<Server Name>/reportserver");
        serverReport.ReportPath =
            "/AdventureWorks Sample Reports/Sales Order Detail";

        // Create the sales order number report parameter
        ReportParameter salesOrderNumber = new ReportParameter();
        salesOrderNumber.Name = "SalesOrderNumber";
        salesOrderNumber.Values.Add("SO43661");

        // Set the report parameters for the report
        reportViewer.ServerReport.SetParameters(
            new ReportParameter[] { salesOrderNumber });
    }
}

0 comments:

Post a Comment

Nam Le © 2014 - Designed by Templateism.com, Distributed By Templatelib