report display one record! from List<T>

wahabwahab iran
edited 9:27AM in FastReport .NET
hi

i am using List As Data Source but Report display one Record Only

using (ShopEntities db = new ShopEntities())
{
Report report = new Report();

report.Load("c:\\report1.frx");

List<CarGroup> List = db.CarGroup.ToList();

report.RegisterData(List, "Table");

report.GetDataSource("Table").Enabled = true;

report.Show();
}


why?

Comments

  • edited 9:27AM
    Hi,

    did you add the fields to a data-band?
    Just tried it like this:
            private class CarGroup {
                public int id {get; set;}
                public String name { get; set; }
    
                public CarGroup(int id, String name)
                {
                    this.id = id;
                    this.name = name;
                }
            }
    
            private void Form1_Load(object sender, EventArgs e)
            {
                List<CarGroup> lst = new List<CarGroup>();
    
                for (int i = 0; i < 10; i++)
                    lst.Add(new CarGroup(i, "Car " + i));
    
                Report report = new Report();
    
                report.Load("c:\\report1.frx");
    
                report.RegisterData(lst, "Table");
    
                report.GetDataSource("Table").Enabled = true;
    
                report.Design();
            }
    
    And the report is created with 10 rows.

    Best regards,
    Keeper

Leave a Comment