locked
How to pass parameter values to the ssrs reports through the SharePoint application? RRS feed

  • Question

  • Hi All,

    I am working on a application developed using SharePoint. I have done the following code in aspx page

    //code//

    ctlid.ReportManagerUrl = "http://servername/Reports";
    ctlid.ReportPath = "/Reports/reportname";

    //code//

    <ReportViewer:SPViewer id="ctlid" __WebPartId="{C3C73DDE-636A-45BE-8DA9-902B2AD3CB9A}"
       Height="550"    Width="1100"    FrameType="None"  ExportControlledProperties="false"  Title="Report Viewer">
    </ReportViewer:SPViewer>

    Now I am trying to pass the value to the parameter to the report. How to add parameter values with ReportPath???

    THanks In Advance.

    Please help.


    Ravi Patil
    Saturday, May 15, 2010 9:31 AM

Answers

  • Hello Ravi,

    First of all, Please verify the check list below:

    1. Have you configured SSRS in SharePoint integrated mode?
    2. Have you created a report library and uploaded the report on the same?
    3. Are you able to run the report directly by clicking on the report?

    Now you have to create a custom web part with the report viewer control and call this report on the same.

    I have done this many times and created a function to call the report in custom web parts:

    private void GenerateReport(string StartDate, string EndDate) { List<ReportParameter> rptParameters = new List<ReportParameter>(); this.rvAQRReport.ProcessingMode = ProcessingMode.Remote; Uri uri = new Uri(<Write your ReportingService URL>); this.rvAQRReport.ServerReport.ReportServerUrl = uri; this.rvAQRReport.ServerReport.ReportPath = this._report; this.rvAQRReport.ShowParameterPrompts = false; this.rvAQRReport.ShowBackButton = false; string [] strReportCredential = ConfigurationManager.AppSettings["credentials"].Split(new char[] {';'}); this.rvAQRReport.ServerReport.ReportServerCredentials = new CustomReportCredentials(strReportCredential[0], strReportCredential[1], strReportCredential[2]); rptParameters.Add(new ReportParameter("StartDate", StartDate)); rptParameters.Add(new ReportParameter("EndDate", EndDate));

    string[] strArray = this.ReportName.Split(new char[] { '.' }); this.rvAQRReport.ServerReport.DisplayName = strArray[0]; this.rvAQRReport.ServerReport.SetParameters(rptParameters); this.rvAQRReport.ServerReport.Refresh(); }

    In above code I have used a variable name _report, where I have assigned the complete URL of the Report:

    this._report = "http://yoursitename/"+<ReportLibraryName>+"//" + <ReportName with extension>; 

    Call this function in your web part and hope that would work for you.

    Please Mark as Answer if the post works for you.

    Cheers,

    


    Amar Deep Singh

    Tuesday, July 2, 2013 6:49 PM