C# 尚未指定报告“Report1”的报告定义
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18650571/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
The report definition for report 'Report1' has not been specified
提问by Aruni Godage
I created a rdlc report in visual studio 2012 webapplication project.t Did all steps correctly (all are done from the UI's) not do any coding when I run the project I alwasy get following error
我在 Visual Studio 2012 webapplication project.t 中创建了一个 rdlc 报告。所有步骤都正确(所有步骤都从 UI 完成)在我运行项目时没有做任何编码我总是收到以下错误
An error occurred during local report processing.
The report definition for report 'Report1' has not been specified
Object reference not set to an instance of an object.
then set the ReportViewer1.LocalReport.ReportPath= property from the codebehind.then error desapier and working properly.my headache was how to set this property without doing any coding ?
然后从代码隐藏设置 ReportViewer1.LocalReport.ReportPath= 属性。然后错误 desapier 并正常工作。我的头痛是如何在不进行任何编码的情况下设置此属性?
回答by Saravana
If by 'without doing any coding' you mean without using the code-behind file, then you can set the ReportPath
property inside the ReportViewer
control itself like so:
如果“不做任何编码”是指不使用代码隐藏文件,那么您可以ReportPath
在ReportViewer
控件本身内部设置属性,如下所示:
<rsweb:ReportViewer id="report" runat="server">
<LocalReport ReportPath="Your report path here"></LocalReport>
</rsweb:ReportViewer>
回答by Hussein Alrubaye
replace this line in your report view
在您的报告视图中替换此行
<LocalReport ReportEmbeddedResource="report.Report1.rdlc">
to this line
到这一行
<LocalReport Reportpath="Report1.rdlc">