Raju
Raju

Reputation: 1

Passing parameter ot RDL report for ASP.NET

I am trying to call rdl reports remotely in ASP.NET, And i was successful calling report without parameter. But when i pass parameter, reporting i not populating and not giving error. It display noting in report. find my code below. and please do suggest me on the same.

MyReportViewer.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;
  MyReportViewer.ServerReport.ReportServerUrl = new Uri(@"http://gblon9sqm10   /ReportServer_DB10");
        MyReportViewer.ServerReport.ReportPath = "/Reports/Report1";
        MyReportViewer.ShowParameterPrompts = false;
        MyReportViewer.ShowPrintButton = true;

        ReportParameter[] rptParameters = new ReportParameter[1];
        rptParameters[0] = new ReportParameter();
        rptParameters[0].Name = "exposureType";
        rptParameters[0].Values.Add("Impressions");
        MyReportViewer.ServerReport.SetParameters(rptParameters);
        MyReportViewer.ServerReport.Refresh();

Upvotes: 0

Views: 6418

Answers (2)

Sohel Pathan
Sohel Pathan

Reputation: 365

I was facing the same problem with same code and configuration as you have mentioned.

I tried bit extra work and get the rid of problem.

I have created a new report with single parameter "Name" and pass value to this parameter from code-behind as ReportParameter. At the report configuration side set the type of parameter text and allow to blank values. Note here i didn't touch any other settings of parameter means kept it as comes by default.

This works for me and then i started adding more parameters and it works perfectly fine.

There is no any browser constraint.

Try as said above and still you face issue then reply me i will put a sample code.

Hope it will help you.

Upvotes: 0

toxaq
toxaq

Reputation: 6838

It's been a while since I set this up but I remember having to make sure that you didn't setup the report again on postback. This is my code in page_load:

if (!Page.IsPostBack)
{
    rptViewer.ServerReport.ReportServerUrl = Settings.ReportServerUrl;
    if (rptViewer.ServerReport.ReportServerCredentials == null)
        rptViewer.ServerReport.ReportServerCredentials = new ReportServerCredentials();
    List<ReportParameter> parameters = new List<ReportParameter>();
    parameters.Add(new ReportParameter("TitleLabel", "Title string here"));
    //More parameters added here...
    rptViewer.ServerReport.SetParameters(parameters);               
}

Upvotes: 1

Related Questions