【问题标题】:ReportViewer Table with list of inherited objects带有继承对象列表的 ReportViewer 表
【发布时间】:2012-04-07 13:11:42
【问题描述】:

我需要显示一个包含继承对象列表的表格。 例如:

public abstract class Animal
{
    public string Name { get; set; }
    public abstract string Detail { get; }
}

public class Dog : Animal
{
    public override Detail { get { return "A dog"; } }
}

public class Cat : Animal
{
    public override Detail { get { return "A cat"; } }
}

似乎数据源采用第一个对象类类型,而其他对象显示为#ERROR 我该如何解决?

【问题讨论】:

    标签: list reportviewer inherited


    【解决方案1】:

    您需要使用表达式区域映射您的属性。如果要显示包含猫详细信息的列,请将其添加到该字段的表达式中。

    =Fields!Cat.Value.Detail
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-10-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多