【问题标题】:Winforms Report (RDLC) binding at run time with an object with a list propertyWinforms Report (RDLC) 在运行时与具有列表属性的对象绑定
【发布时间】:2015-11-10 16:42:40
【问题描述】:

我有一个对象,其中包含有关订单的标题级别详细信息以及订单详细信息列表。

标题信息填充得很好,但我不知道如何将订单详细信息列表绑定到报告中的 tablix。

这是错误的方法吗? 数据连接是在运行时确定的,所以我认为我不能轻易地将子报表挂接到数据库并通过过滤器。

编辑:我应该补充一点,我有一个带有 ReportViewer 的父表单,如果它有所作为的话。那是我设置数据源的地方。

    public class FormulaHeaderModel
{
    public string flavor { get; set; }
    public string name { get; set; }
    public string author { get; set; }
    public string formulaId { get; set; }
    public string formulaNumber { get; set; }
    public string formulaType { get; set; }
    public string accessLevel { get; set; }
    public string createdOnDate { get; set; }
    public string formulaWeight { get; set; }
    public string note { get; set; }
    public List<FormulaDetailModel> dataCharacterizing { get; set; }
    public List<FormulaDetailModel> dataContributory { get; set; }
    public List<FormulaDetailModel> dataGlobal { get; set; }
    public List<FormulaDetailModel> dataCarrier { get; set; }
}
    public class FormulaDetailModel
{
    public int formulaID { get; set; }
    public int ingredientTypeId { get; set; }
    public string codeFema { get; set; }
    public decimal ingredientCost { get; set; }
    public string name { get; set; }
    public string natural { get; set; }
    public decimal ppm { get; set; }
    public decimal percentSolution { get; set; }
    public decimal grams {get; set;}
}

我需要为每个列表创建一个 tablix。

所以顶部是字符串级别信息,然后是 4 个 FormulaDetailModel 列表中的每一个的标签和 tablix(或其他任何内容)。

【问题讨论】:

  • 这听起来应该是可行的——你能分享你试图报告的数据结构吗?以及所需的输出(即使是设计的油漆模型也会有所帮助)
  • 刚刚编辑以包含数据结构。

标签: c# winforms reporting-services rdlc


【解决方案1】:

知道了。只要名称与设置表的数据集名称匹配,我就可以添加第二个数据源。

this.reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("FormulaDetailModel", fhModel.dataCharacterizing ));

【讨论】:

    猜你喜欢
    • 2011-06-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-12-21
    • 1970-01-01
    • 1970-01-01
    • 2015-09-29
    相关资源
    最近更新 更多