Trouble with business objects

Stimulsoft Reports.NET discussion
Post Reply
Tobias
Posts: 102
Joined: Mon Nov 24, 2008 8:44 am

Trouble with business objects

Post by Tobias »

Having a business object with two List<T> properties, I'm having trouble with printing those lists. Instead of printing the first list and then the second one, it prints the first, the second and then AGAIN the first and the second.

Any ideas why this doesn't work?

MRT-File attached, code looks like this:

Code: Select all

public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
    }

    private void button1_Click(object sender, EventArgs e)
    {
        var stiReport = new StiReport();
        stiReport.Load("Report.mrt");
        stiReport.RegBusinessObject("Foo", new BusinessObject
        {
            List1 = new List<Foo>
            {
                new Foo { Number = 1, Name = "Walter"},
                new Foo { Number = 2, Name = "Rick"},
            },
            List2 = new List<Foo>
            {
               new Foo { Number = 10, Name = "Maura"},
               new Foo { Number = 11, Name = "Veronica"}
            }
        });
        stiReport.Dictionary.SynchronizeBusinessObjects(2);
        stiReport.Design();
    }
}

public class BusinessObject
{
    public List<Foo> List1 { get; set; }
    public List<Foo> List2 { get; set; }
}

public class Foo
{
    public int Number { get; set; }
    public string Name { get; set; }
}
Attachments
Report.mrt
(11.41 KiB) Downloaded 121 times
Lech Kulikowski
Posts: 6245
Joined: Tue Mar 20, 2018 5:34 am

Re: Trouble with business objects

Post by Lech Kulikowski »

Hello,

Please add main BO level on the page for correct rendering.

Thank you.
Attachments
Capture.PNG
Capture.PNG (65.35 KiB) Viewed 1195 times
Tobias
Posts: 102
Joined: Mon Nov 24, 2008 8:44 am

Re: Trouble with business objects

Post by Tobias »

Ok, I see - not exactly "intuitive", but it works this way. Thanks!
Lech Kulikowski
Posts: 6245
Joined: Tue Mar 20, 2018 5:34 am

Re: Trouble with business objects

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