如何使用ASP.NET ReportViewer访问子对象的属性?

时间:2022-10-15 08:22:40

In our project we are using MS ReportViewer to view the page for printing. The problem I face is when binding the local report with the object data source it sees the top level properties but not the child object's properties!

在我们的项目中,我们使用MS ReportViewer查看要打印的页面。我面临的问题是当本地报表与对象数据源绑定时,它会看到*属性,但不会看到子对象的属性!

Is there any method to see these properties of the child object?

是否有任何方法可以查看子对象的这些属性?

3 个解决方案

#1


0  

Which version of the report viewer? This is a bug in the 2010 version of the control. The work around is to bring the properties up to the top level object.

哪个版本的报告查看器?这是2010版控件中的错误。解决方法是将属性提升到*对象。

 public class MyTopLevelObject {

     public int MyChildsProperty {
         get {
              return _myChild.Property;
         }
     }
 }

Yeah it's not the greatest :-/

是的,这不是最伟大的: - /

#2


1  

Just an update to this, its now fixed in SP1. The requirement to get it to work is to make sure ALL classes used in properties of the datasource are serializable.

只是对此的更新,它现在已在SP1中修复。让它工作的要求是确保数据源属性中使用的所有类都是可序列化的。

more info at:

更多信息:

http://wraithnath.blogspot.com/2011/04/reportviewer-object-datasource-nested.html

http://wraithnath.blogspot.com/2011/04/reportviewer-object-datasource-nested.html

#3


0  

Make sure you've marked your class and its properties classes as [Serializable].

确保您已将类及其属性类标记为[Serializable]。

It has worked for me!

它对我有用!

#1


0  

Which version of the report viewer? This is a bug in the 2010 version of the control. The work around is to bring the properties up to the top level object.

哪个版本的报告查看器?这是2010版控件中的错误。解决方法是将属性提升到*对象。

 public class MyTopLevelObject {

     public int MyChildsProperty {
         get {
              return _myChild.Property;
         }
     }
 }

Yeah it's not the greatest :-/

是的,这不是最伟大的: - /

#2


1  

Just an update to this, its now fixed in SP1. The requirement to get it to work is to make sure ALL classes used in properties of the datasource are serializable.

只是对此的更新,它现在已在SP1中修复。让它工作的要求是确保数据源属性中使用的所有类都是可序列化的。

more info at:

更多信息:

http://wraithnath.blogspot.com/2011/04/reportviewer-object-datasource-nested.html

http://wraithnath.blogspot.com/2011/04/reportviewer-object-datasource-nested.html

#3


0  

Make sure you've marked your class and its properties classes as [Serializable].

确保您已将类及其属性类标记为[Serializable]。

It has worked for me!

它对我有用!