Add A dataBand In the middile of report

Stimulsoft Reports.NET discussion
Post Reply
Liewai25
Posts: 5
Joined: Mon Jun 25, 2018 2:47 pm

Add A dataBand In the middile of report

Post by Liewai25 »

Hi, ley say I have a report with

ReportTitleBand
GroupHeaderBand
DataBand1
DataBand2
FooterBand

If I want to add a new databand between the databand1 and databand2 in code, how do i achieve it? If using page.components.add(databand) , it will add at the bottom.
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Re: Add A dataBand In the middile of report

Post by Edward »

Hi Liewai,

There are several ways to do that.

You could have a DataBand3 placed in the page beforehand but with Enabled=false property and to set Enabled=true when required.
If you have a look to the 'Code' tab in the Designer and check the auto-generated code there, you might find the 'under the hood' behaviour of the report engine, when the report is generated, something like that;

Code: Select all

            this.Page1.Components.AddRange(new Stimulsoft.Report.Components.StiComponent[] {
                        this.DataBand1,
                        this.DataBand3,
                        this.DataBand2});
As you mentioned, the order in which the databands are added is important in this case.

Thank you,
Edward
Post Reply