Click here to Skip to main content
15,881,852 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I would like to stick with one single form and ReportViewer control, and at runtime assign various reports and data sources. The diverse and complex solutions to this revealed by a quick google check prompted me to rather ask here. How can I achieve this?
Posted
Updated 26-Sep-12 21:14pm
v2

1 solution

Simple, you just need to change to parameter to achieve that!

1. Change Report Path
C#
ReportViewer1.LocalReport.ReportPath =  YOUR REPORT PATH


2. Add DataSource with exact DS name as defined in your RDLC file like this

C#
 var ReportDS= YOUR DATASET

ReportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource()
                {
                    Name="DSNAME",
                    Value = ReportDS
                });


It's Done
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900