Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/visual-studio/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 将RDL报告加载到Web报告查看器中_Asp.net_Visual Studio_Web Applications_Reporting Services - Fatal编程技术网

Asp.net 将RDL报告加载到Web报告查看器中

Asp.net 将RDL报告加载到Web报告查看器中,asp.net,visual-studio,web-applications,reporting-services,Asp.net,Visual Studio,Web Applications,Reporting Services,我正在尝试将(.rdl)报表文件加载到web报表查看器控件(visual studio 2010控件)中: 我是不是漏了一行代码?我在winforms报表查看器中使用了等效的方法,并添加了RefreshReport()——但是我找不到适用于web报表查看器的等效方法)。页面仍然空白-我缺少什么?有一个.Refresh()方法,这就是您缺少的。下面是我正在使用的(在VB中): ReportViewer1.Reset() ReportViewer1.LocalReport.Dispose() Rep

我正在尝试将(.rdl)报表文件加载到web报表查看器控件(visual studio 2010控件)中:

我是不是漏了一行代码?我在winforms报表查看器中使用了等效的方法,并添加了RefreshReport()——但是我找不到适用于web报表查看器的等效方法)。页面仍然空白-我缺少什么?

有一个
.Refresh()
方法,这就是您缺少的。下面是我正在使用的(在VB中):

ReportViewer1.Reset()
ReportViewer1.LocalReport.Dispose()
ReportViewer1.LocalReport.DataSources.Clear()
ReportViewer1.LocalReport.ReportPath=Server.MapPath(“/reports/”&ReportFile)
ReportViewer1.LocalReport.DataSources.Add(新建ReportDataSource())
ReportViewer1.LocalReport.Refresh()

好的,我添加了您提到的行,但这似乎不是问题所在-页面仍然是空白的……您在问题中说您正在尝试加载RDL文件。是RDL还是RDLC?RDLC是您需要的格式,C代表客户机。RDL文件用于Reporting Services。为什么我需要.rdlc?我有一个.rdl的-不完全确定区别是什么?我在使用winform.ReportVieweral时得到了这个结果。实际上,考虑一下更多的RDL报告就可以了。RDL文件与ReportViewer控件兼容。但是RDL文件并不包含ReportViewer控件在设计时生成数据绑定所依赖的所有位。但是手动数据绑定您可以在ReportViewer中使用RDL文件。我可以很好地执行手动数据绑定。RDL的工作很好,就像我想用的那样。一个奇怪的现象是,使用这个.controls.add(reportviewer)会导致它出现…但它已经在设计器中被拖动了。。。
    //Get the data and 
    .
    .
    //Add it to report
    ReportViewer.LocalReport.DataSources.Add(new ReportDataSource(element.Name, dt));

    //Pass the report to the viewer
    using (FileStream stream = new FileStream(ReportDocument.FileName, FileMode.Open))
    {
       this.ReportViewer.LocalReport.LoadReportDefinition(stream);
    }
ReportViewer1.Reset()
ReportViewer1.LocalReport.Dispose()
ReportViewer1.LocalReport.DataSources.Clear()
ReportViewer1.LocalReport.ReportPath = Server.MapPath("/reports/" & ReportFile)
ReportViewer1.LocalReport.DataSources.Add(New ReportDataSource(<datasource>))
ReportViewer1.LocalReport.Refresh()