Add DataBand in Report.BeginRender

Stimulsoft Reports.WEB discussion
Post Reply
ChrisHolland
Posts: 45
Joined: Tue May 21, 2019 1:44 pm

Add DataBand in Report.BeginRender

Post by ChrisHolland »

I am trying to dynamically create data bands from my data within a report.
I have added the following code to the Report.BeginRender event

======================================
//Create Databand
StiDataBand dataBand = new StiDataBand();
dataBand.DataSourceName = "{SectionList}";
dataBand.Height = 0.5;
dataBand.Name = "SectionDataBand";
Page1.Components.Add(dataBand);

//Create text
StiText dataText = new StiText(new RectangleD(0, 0, 5, 0.5));
dataText.Text = "{SectionList.Name}";
dataText.Name = "SectionNameEdit";
dataBand.Components.Add(dataText);
======================================

But when I preview the report no data bands are shown.
(SectionList contains 3 items at this point)

Chris Holland
SEC Solutions Ltd.
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Add DataBand in Report.BeginRender

Post by HighAley »

Hello, Chris.

Please, try to open the report in the Designer

Thank you.
ChrisHolland
Posts: 45
Joined: Tue May 21, 2019 1:44 pm

Re: Add DataBand in Report.BeginRender

Post by ChrisHolland »

I did open the report in the designer - still the same!

What was supposed to be different in the designer?
ChrisHolland
Posts: 45
Joined: Tue May 21, 2019 1:44 pm

Re: Add DataBand in Report.BeginRender

Post by ChrisHolland »

I have attached a small test report
Attachments
TestReport.zip
(2.39 KiB) Downloaded 159 times
Lech Kulikowski
Posts: 6263
Joined: Tue Mar 20, 2018 5:34 am

Re: Add DataBand in Report.BeginRender

Post by Lech Kulikowski »

Hello,

You can add all necessary components on the page, then open code tab and use same code.
Please check the sample report in the attachment.

Thank you.
ChrisHolland
Posts: 45
Joined: Tue May 21, 2019 1:44 pm

Re: Add DataBand in Report.BeginRender

Post by ChrisHolland »

Sorry but I can't see an attachment!
Lech Kulikowski
Posts: 6263
Joined: Tue Mar 20, 2018 5:34 am

Re: Add DataBand in Report.BeginRender

Post by Lech Kulikowski »

Hello,

Was attached.
Attachments
sample.mrt
(4.33 KiB) Downloaded 183 times
ChrisHolland
Posts: 45
Joined: Tue May 21, 2019 1:44 pm

Re: Add DataBand in Report.BeginRender

Post by ChrisHolland »

Thanks all working now.
Lech Kulikowski
Posts: 6263
Joined: Tue Mar 20, 2018 5:34 am

Re: Add DataBand in Report.BeginRender

Post by Lech Kulikowski »

Hello

We are always glad to help you!
Please let us know if you need any additional help.

Thank you.
Post Reply