private void BindDataToGridView() { //List<Student> list = new List<Student>(); //list = GetDataSource().Where(a => { return a.Age == 24; }).ToList(); //gvMain.DataSource = list; //IEnumerable<Student> list; //List<Student> list2; //list = GetDataSource().Where(a => a.Age == 24); //list2 = list.ToList(); //gvMain.DataSource = GetDataSource().Where(a => a.Age == 24).ToList(); List <Student> list = new List <Student>(); //List<Student> list2; list.Add(new Student() { StuId = 2008011217, StuName = "陈义", Age = 24 }); list.Add(new Student() { StuId = 2008011218, StuName = "陈林", Age = 26 }); string json = JsonHelper.SerializeObject(list); IEnumerable <Student> studentInfo = JsonHelper.DeserializeJsonToCollection <Student>(json); gvMain.DataSource = studentInfo; DataTable dt = new DataTable(); DataColumn dc = new DataColumn(); dc.ColumnName = "Name"; dt.Columns.Add(dc); DataRow dr = dt.NewRow(); dr["Name"] = "陈义"; dt.Rows.Add(dr); Option <string> o = new Option <string>(); ReportGenerator r = new ReportGenerator(dt, o); var r2 = r.AddSubReport(o); r2.ChangePreReport(r, dt); var r3 = r.AddSubReport(o); r2.DropReport(); r2.DropReport(); //list2 = list.Where(c => c.Age == 24).ToList(); }
public void Testasd() { DataTable dt = new DataTable(); dt.Columns.Add("Id"); dt.Rows.Add(1); ReportGenerator root = new ReportGenerator(dt, new Option <string>() { GroupName = "RefId", Value = "RefId" }, "Father"); var son = root.AddSubReport(new Option <string>() { GroupName = "Son", Value = "Son" }, "Son"); var grandson = root.AddSubReport(new Option <string>() { GroupName = "Grandson", Value = "Grandson" }, "Grandson"); root.GenerateReport(); son.DropReport(); }