Wrong Record in the Page Header Section

This is an issue that our customers ask about often. To get a clear handle on the situation, let me clarify some basic points about how Section reports work.


First, in Section reports, ActiveReports renders each section to the page in the order that it reads the records from the data source. ActiveReports automatically breaks to a new page when it determines that the records will overflow the output area. Second, when you group data in a Section report, your report reads ahead in the records to the end of the group. This means that ActiveReports reads records from the data source one by one until it determines that the group has changed, that is, the value of the grouped-on field changes.


How does this affect our page header? Well, reading ahead could cause the second record on the page to render rather than the first because the PageHeader section is not made to handle data bound controls.


Section report showing the bound textbox in the GroupHeader section rather than the PageHeader section To display the first record at the top of each page, use the GroupHeader section rather than the PageHeader. You can even remove the PageHeader section altogether if this was its only purpose. Also, set the RepeatStyle property on the GroupHeader to OnPage or OnPageIncludeNoDetail so that the GroupHeader section appears on every page. (OnPageIncludeNoDetail prevents orphaned GroupFooter sections on pages that don't have any more records in the Detail section.)

PageHeader Usage

Use the PageHeader section to render information that has nothing to do with the data source of the report, for example, static strings such as the report title or page titles, or data about the report such as page numbers or the report run date.

Caution: To avoid getting your data out of whack, do not place any bound report controls in the PageHeader or PageFooter section.

For more information, see the recent blog article Three Ways to Use Summaries in Section Reports. Also check out Add Grouping in Section Reports and Grouping Data in Section Reports in our User Guide.


GrapeCity Developer Tools
comments powered by Disqus