Priyank Patel
Priyank Patel

Reputation: 6996

Showing report in Report Viewer based on conditions?

I am using ASP.NET/C#.Currently I am displaying simple Report following this tutorial.

In this tutorial they just selected the fields to display and it displayed the Reports.

What about Reports based on some conditions?

How can I show reports based on conditions?

Example:

Show the details of Employees whose name begins with 'A'. I hope I am able to explain my question.

Can anyone help me to do this?

Any suggestions are welcome.

Upvotes: 0

Views: 3305

Answers (2)

nunespascal
nunespascal

Reputation: 17724

Reports take parameters. You can set these to filter out the data.

This set of tutorials should get you started: Adding Parameters to reports

Upvotes: 0

Luuk Krijnen
Luuk Krijnen

Reputation: 1192

Do you mean something like this?

ReportDataSource rds0 = new ReportDataSource("DataSetNameDefinedInReport", data);
this.reportViewer1.LocalReport.ReportPath = @"Reportname.rdlc";
this.reportViewer1.LocalReport.DataSources.Add(rds0);
//show report!
this.reportViewer1.RefreshReport();

The "data" in my case is a generic List of custom objects

Upvotes: 2

Related Questions