如何在报告中显示列表中的列表?
我在 MVC 应用程序(.rdlc 文件)中使用标准报告引擎来生成报告。
基本上我有一个需要在表格中显示的项目列表...但是该项目列表包含一个也需要显示的列表。
我想要实现的一个很好的例子就是分类。可以这样想:
我有一个类别列表,其中包含该类别中的产品列表。报告需要是这样的:
Category A
Product 1 Name Product 1 Description Price
Product 2 Name Product 2 Description Price
Product 3 Name Product 3 Description Price
Category B
Product 4 Name Product 4 Description Price
等等...... 我按照需要的方式设置了类,报告数据源是一个从使用某些参数获取信息的函数返回的列表。我知道如何显示类别列表,但不知道如何显示其中的列表。
所以问题是,如何在报表的主列表中显示记录的子列表?
编辑 这是我的示例场景的示例数据结构
public class Category
{
public string CategoryName { get; set; }
public List<Product> Products { get; set; }
}
public class Product
{
public string Name { get; set; }
public string Description { get; set; }
public decimal Price { get; set; }
}
I'm using the standard reporting engine in a MVC application (.rdlc files) to generate a report.
Basically I have a list of items that need to be displayed in a table... but that list of items contains a list that also needs to be displayed.
A good example of what I am trying to achieve is categorization. Think of it this way:
I have a list of categories with a list of products in the category. The report needs to be something like this:
Category A
Product 1 Name Product 1 Description Price
Product 2 Name Product 2 Description Price
Product 3 Name Product 3 Description Price
Category B
Product 4 Name Product 4 Description Price
and so on....
I have the classes setup the way they need to be and the report data source is a list that is returned from a function that fetches the info with some parameters. I know how to display the list of categories, but not the list within them.
So the question is, how can i display a child list for a record in the main list in a report?
EDIT
here is an example data structure for my example scenario
public class Category
{
public string CategoryName { get; set; }
public List<Product> Products { get; set; }
}
public class Product
{
public string Name { get; set; }
public string Description { get; set; }
public decimal Price { get; set; }
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于任何可能在寻找答案时发现此问题的人,我在这里找到了它
http://forums.asp.net/p/1432888/3224866.aspx#3224866
For any of those who may find this question in search of the answer, I found it here
http://forums.asp.net/p/1432888/3224866.aspx#3224866