reportviewer 这个怎么加载dll中的rdlc

 我来答
xiangjuan314
2016-03-29 · TA获得超过3.3万个赞
知道大有可为答主
回答量:2.9万
采纳率:0%
帮助的人:2879万
展开全部
Solution 1:
使用多个ReportViewer,每个ReportViewer显示不同的RDLC。根据用户的选择显示洞卜一个ReportViewer,隐藏其他的ReportViewer。就在页面中添加多个ReportViewer控件来对应多个rdlc文件,然后根据需要显示和隐藏部分ReportViewer控件。
Solution 2:
Because there is no ReportViewer.Reset() in C#, the solution is to create an new instance of the report. The trick is to Swap out the previous ReportViewer with the New ReportViewer.
ControlCollection cc = this.ReportViewer1.Parent.Controls;
/纳核穗/get index of previous ReportViewer so we can swap it out.
int prevIndex = cc.IndexOf(this.ReportViewer1);
// Remove previous ReportViewer
cc.Remove(this.ReportViewer1);
//add new instance of ReportViewer.
ReportViewer1 = new Microsoft.Reporting.WebForms.ReportViewer();
// Reset report properties.
ReportViewer1.Height = Unit.Parse("100%");
ReportViewer1.Width = Unit.Parse("100%");
ReportViewer1.CssClass = "table";
//Add the new ReportViewer to the previous ReportViewer location.
cc.AddAt(prevIndex, ReportViewer1);
// Clear out any previous datasources.
this.ReportViewer1.LocalReport.DataSources.Clear();
/氏指/Set report mode for local processing.
ReportViewer1.ProcessingMode = ProcessingMode.Local;
// Create a new report dataset.
DataSet dataSet = new DataSet();
this.ReportViewer1.LocalReport.ReportPath = Server.MapPath("ReportPeopleMailingList.rdlc");
// Load dataset.
try
{ // retrieve dataset.
dataSet = (DataSet)Session["sessionDataSetCli"]; }
catch
{
return;
}
// Assign report parameters.
Microsoft.Reporting.WebForms.ReportParameter[] parms = new Microsoft.Reporting.WebForms.ReportParameter[1];
parms[0] = new Microsoft.Reporting.WebForms.ReportParameter("title", "Clients");
ReportViewer1.LocalReport.SetParameters(parms);
// Load the dataSource.
ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSetPeople_adPeople", dataSet.Tables[0]));
// Refresh the ReportViewer
ReportViewer1.LocalReport.Refresh();

Dim cc As ControlCollection = ReportViewer1.Parent.Controls
Dim prevIndex As Integer = cc.IndexOf(ReportViewer1)
cc.Remove(ReportViewer1)
ReportViewer1 = New Microsoft.Reporting.WebForms.ReportViewer()
ReportViewer1.Height = Unit.Parse("450px")
ReportViewer1.Width = Unit.Parse("980px")
cc.AddAt(prevIndex, ReportViewer1)
ReportViewer1.LocalReport.DataSources.Clear()
ReportViewer1.LocalReport.ReportPath = reportPath
ReportViewer1.LocalReport.DataSources.Add(datasource)
ReportViewer1.LocalReport.SetParameters(New ReportParameter() {.....})
ReportViewer1.LocalReport.Refresh()
Solution 3:

Must do a
ReportViewer1.Reset()
ReportViewer1.LocalReport.Dispose()
first. Then set your reportpaths, then do a
ReportViewer1.LocalReport.Refresh()
You must have VS2005 SP1 for this.
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式