Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/12.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
C# 如何将ReportViewer绑定到IEnumerable<;T>;_C#_Asp.net_Reporting Services_Reporting_Reportviewer - Fatal编程技术网

C# 如何将ReportViewer绑定到IEnumerable<;T>;

C# 如何将ReportViewer绑定到IEnumerable<;T>;,c#,asp.net,reporting-services,reporting,reportviewer,C#,Asp.net,Reporting Services,Reporting,Reportviewer,我开始使用MS Report,我想知道是否可以将ReportViewer组件直接绑定到IEnumerable集合,而不是像使用数据绑定组件那样创建数据源控件(ObjectDataSource、EntityDataSource、SqlDataSource等)(使用Datasource属性而不是DataSourceID)。我知道ReportViewer没有“Datasource”属性,但我想知道是否有类似的方法 在我的例子中,我使用的是一个具有存储库模式和实体框架(POCO EF 4.1)的nTie

我开始使用MS Report,我想知道是否可以将ReportViewer组件直接绑定到IEnumerable集合,而不是像使用数据绑定组件那样创建数据源控件(ObjectDataSource、EntityDataSource、SqlDataSource等)(使用Datasource属性而不是DataSourceID)。我知道ReportViewer没有“Datasource”属性,但我想知道是否有类似的方法

在我的例子中,我使用的是一个具有存储库模式和实体框架(POCO EF 4.1)的nTier应用程序


谢谢!

您需要为报表创建一个reportDataSource(使用设计器)。您将要求提供reportDateSource的名称和类型(IEnumerable集合的实体类型)(让我们为您命名id“test”,您的数据类型为Client)


仅此而已。

您是否检查过在本地处理模式下使用带有ReportViewer Web服务器控件的业务对象数据源?谢谢@Jonathan。这非常有帮助,让事情变得更简单!
ReportDataSource reportDataSource = New ReportDataSource("test", listofclients);
localreport.DataSources.Add(reportDataSource);