首页 新闻 会员 周边

水晶报表的问题

0
悬赏园豆:10 [已解决问题] 解决于 2015-08-14 12:54

报表设计如图

实体类:

 1     public class TheClass {
 2         public string TheClass_Id { get; set; }
 3         public string ClassId { get; set; }
 4         public string ClassName { get; set; }
 5         //public List<Student> Students { get; set; }
 6     }
 7     public class Students {
 8         public string TheClass_Id { get; set; }
 9         public string Student_Id { get; set; }
10     }
11     public class Student
12     {
13         public string Student_Id { get; set; }
14         public string ID { get; set; }
15         public string Name { get; set; }
16     }

asp.net pageload事件:

 1    protected void Page_Load(object sender, EventArgs e)
 2         {
 3             if (IsPostBack)
 4             {
 5                 return;
 6             }
 7             ReportDocument report = new ReportDocument();
          //水晶报表文件路径
8 string ReprtName = Server.MapPath("~/") + "Rplt\\" + "Rplt.rpt"; 9 report.Load(ReprtName); 10 11 12 List<TheClass> listthe = new List<TheClass>(); 13 for (int i = 0; i < 3; i++) 14 { 15 TheClass the1 = new TheClass() 16 { 17 TheClass_Id = i.ToString(), 18 ClassId = i.ToString(), 19 ClassName = i.ToString() + "", 20 }; 21 listthe.Add(the1); 22 } 23 List<Student> liststu = new List<Student>(); 24 for (int i = 0; i < 3; i++) 25 { 26 Student the1 = new Student() 27 { 28 ID = i.ToString(), 29 Student_Id = i.ToString(), 30 Name = i.ToString() + "", 31 }; 32 liststu.Add(the1); 33 } 34 List<Students> liststus = new List<Students>(); 35 for (int i = 0; i < 3; i++) 36 { 37 Students the1 = new Students() 38 { 39 Student_Id = i.ToString(), 40 TheClass_Id = i.ToString(), 41 }; 42 liststus.Add(the1); 43 } 44 DataSet ds = new DataSet();
        //Tool.LinqHelper.ConvertToTable 此方法 将list装datatable
45 DataTable dt1= Tool.LinqHelper.ConvertToTable(listthe.AsQueryable(); 46 dt1.TableName = "TheClass"; 47 DataTable dt2 = Tool.LinqHelper.ConvertToTable(liststu.AsQueryable(; 48 dt2.TableName = "Student"; 49 DataTable dt3 = Tool.LinqHelper.ConvertToTable(liststus.AsQueryable)); 50 dt3.TableName = "Students"; 51 ds.Tables.Add(dt1); 52 ds.Tables.Add(dt2); 53 ds.Tables.Add(dt3); 56 report.SetDataSource(ds); 57 this.CrystalReportViewer1.ReportSource = report; 58 this.CrystalReportViewer1.ShowLastPage(); 59 this.CrystalReportViewer1.ShowFirstPage(); 60 }

班级表 TheClass 主表,学生student表 为次表,报表上面 一次性只能显示 一条 主表信息

请问代码如上  主表有3条数据

怎么让给报表分页,然他每页显示不同的 班级表(theClass)表 信息呢?

 

 

疯痴傻的主页 疯痴傻 | 初学一级 | 园豆:154
提问于:2015-08-13 11:49
< >
分享
最佳答案
0

按照班级分组,每个分组结束之后分页。

收获园豆:10
清海扬波 | 小虾三级 |园豆:825 | 2015-08-13 13:59

能说下怎么分么??

疯痴傻 | 园豆:154 (初学一级) | 2015-08-13 15:56

@唐@: 百度一下吧,分组都是最基本的操作了。

清海扬波 | 园豆:825 (小虾三级) | 2015-08-14 09:54
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册