Click here to Skip to main content
12,511,734 members (45,872 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: .NET SSRS
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 26-Sep-12 20:45pm
Updated 26-Sep-12 21:14pm
v2

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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

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

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

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

It's Done
  Permalink  

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160929.1 | Last Updated 10 Oct 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100