report display one record! from List<T>

wahabwahab iran
edited 5:23AM 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 5:23AM
    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

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.