惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Security Latest
Security Latest
T
The Exploit Database - CXSecurity.com
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
Tor Project blog
Help Net Security
Help Net Security
PCI Perspectives
PCI Perspectives
T
The Blog of Author Tim Ferriss
H
Heimdal Security Blog
The Register - Security
The Register - Security
Schneier on Security
Schneier on Security
宝玉的分享
宝玉的分享
Google DeepMind News
Google DeepMind News
人人都是产品经理
人人都是产品经理
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
C
CERT Recently Published Vulnerability Notes
L
LangChain Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
MongoDB | Blog
MongoDB | Blog
美团技术团队
S
Security @ Cisco Blogs
Cloudbric
Cloudbric
Cisco Talos Blog
Cisco Talos Blog
C
Cybersecurity and Infrastructure Security Agency CISA
月光博客
月光博客
B
Blog RSS Feed
Cyberwarzone
Cyberwarzone
U
Unit 42
AWS News Blog
AWS News Blog
F
Fortinet All Blogs
L
LINUX DO - 最新话题
GbyAI
GbyAI
T
Threat Research - Cisco Blogs
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
A
About on SuperTechFans
Hugging Face - Blog
Hugging Face - Blog
Attack and Defense Labs
Attack and Defense Labs
Engineering at Meta
Engineering at Meta
MyScale Blog
MyScale Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
V2EX - 技术
V2EX - 技术
Y
Y Combinator Blog
T
Tailwind CSS Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
Recorded Future
Recorded Future
TaoSecurity Blog
TaoSecurity Blog
博客园_首页
C
CXSECURITY Database RSS Feed - CXSecurity.com
M
MIT News - Artificial intelligence
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
H
Hacker News: Front Page

博客园 - 阿修罗一平

IIS部署WCF出现的各种问题汇总 Infragistics控件的工具栏注册 NUnit的使用中可能遇到的问题 Linq备忘 Nihibernate的重要知识点 Devexpress使用记录 PDA访问WCF PDA(WinCE)项目开发中遇到的问题及解决方法总结 Grid控件绑定bindingSource后在新增行时设置Cell的初始值 “BindingSource绑定单个实体对象后在代码中赋值无效和无法显示”的解决方法 sqlservier2005转成sqlserver2000中出现的问题(WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]) 项目考虑因素及解决方案(.net) 设计模式在工作中的应用(三) 设计模式在工作中的应用(二) 设计模式在工作中的应用(一) NHibernate示例 Remoting服务集成到IIS的简单总结 关于Remoting服务启动和停止的简单总结 将公司系统从SqlServer 2K移植到Oracle 10g中的简要总结
使用List数据集合,利用DevExpress.XtraReports开发Master-Detail报表
阿修罗一平 · 2009-11-12 · via 博客园 - 阿修罗一平

  以前使用的是ActiveReport开发报表,第一次使用DevExpress开发报表,如遇到不正确的地方随意拍砖。一般在开发报表的时候,特别是开发Master-Detail结构的报表的时候,我们多数时候会选择DataSet作为数据源,今天讲讲如何使用List或者数组作为数据集合:

1、创建业务对象

public class Person
    {
        public string Name { get; set; }
        public int Age { get; set; }
    }


public class Room
    {
        public string No { get; set; }
        public List<Person> Persons { get; set; }//或者是List,或者是Person[],不能是IList,否则设计器在设置字表绑定时无法解                                                                         //析出Person的结构,其他的没有试过,没时间在这上面纠缠
    }

2、创建一个测试项目,创建一个XtraReport,添加一个bindingSource,比如Name是bindingSource1,绑定的类型是Room

3、在Detail中添加控件xrLabel1,然后控件的Text属性绑定Room的属性No。

4、右击Detail,增加一个Deatil Report,然后设置Deatil Report的datasouce 为"bindingSource1",datamember为"Persons ",如果不这样设置将无法显示出数据。然后添加控件xrLabel2,xrLabel3,其Text绑定Person的属性Name 和Age即可。

5、报表的设计工作已经完成,然后就是通过按钮调用报表类,并将获取的IList<Room>数据集合传入到XtraReport类中,调用ShowPreview()就可以看到效果了。

项目代码:https://files.cnblogs.com/yiping06993010/ReportTest.rar