Create Sections Programmatically
To create sections in code, instantiate the appropriate object, set its properties, and add it to the Report object's Items collection. The objects you will need to work with are:
- DetailSection - for a detail section
- GroupHeaderSection - for a group header
- GroupFooterSection - for a group footer
- PageHeaderSection - for a page header
- PageFooterSection - for a page footer
- ReportHeaderSection - for a report header
- ReportFooterSection - for a report footer
For example, this code creates a detail section and adds it to the report:
DetailSection detail = new DetailSection();
this.detail.Height = new Telerik.Reporting.Drawing.Unit(3.0, Telerik.Reporting.Drawing.UnitType.Inch);
this.detail.Name = "detail";
report.Items.Add((ReportItemBase)detail);
Dim detail As New DetailSection()
Me.detail.Height = New Telerik.Reporting.Drawing.Unit(3, Telerik.Reporting.Drawing.UnitType.Inch)
Me.detail.Name = "detail";
report.Items.Add(DirectCast(detail, ReportItemBase)