本文介绍了将一个ReportViewer控件用于许多不同的rdlc报表.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想坚持一种单一的形式和ReportViewer控件,并在运行时分配各种报告和数据源.快速的Google检查显示了针对此问题的多样化和复杂的解决方案,这促使我宁愿在这里提问.
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?
推荐答案很简单,您只需更改参数即可实现! 1.更改报告路径 Simple, you just need to change to parameter to achieve that! 1. Change Report Path ReportViewer1.LocalReport.ReportPath = YOUR REPORT PATH
2.像这样在RDLC文件中添加具有确切DS名称的数据源
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
更多推荐
将一个ReportViewer控件用于许多不同的rdlc报表.
发布评论