Click here to Skip to main content
11,503,839 members (70,490 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: .NET SSRS WinForm
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
Edited 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
0 Sergey Alexandrovich Kryukov 238
1 OriginalGriff 180
2 Peter Leow 170
3 DamithSL 150
4 F-ES Sitecore 140
0 Sergey Alexandrovich Kryukov 698
1 Maciej Los 435
2 Peter Leow 420
3 DamithSL 395
4 OriginalGriff 357


Advertise | Privacy | Mobile
Web04 | 2.8.150520.1 | Last Updated 10 Oct 2012
Copyright © CodeProject, 1999-2015
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