Nested Group

Hellow,

How Can I Set NestedGorup Programmatic
when my code is this :
LastGroupHeader.NestedGroup = new FastReport.GroupHeaderBand();
I encounter this exception :
Object of type GroupHeaderBand cannot contain objects of type GroupHeaderBand


Comments

  • edited 3:57AM
    Hello,

    You have to disconnect the main group's Data band first, before adding a nested group:
          // create the main group
          GroupHeaderBand mainGroup = new GroupHeaderBand();
          mainGroup.Height = Units.Millimeters * 10;
          mainGroup.Name = "MainGroup";
          mainGroup.Condition = "[Orders.CustomerName]";
          // add a group to the page
          page.Bands.Add(mainGroup);
    
          // create a data band
          DataBand dataBand = new DataBand();
          dataBand.Height = Units.Millimeters * 10;
          dataBand.Name = "GroupData";
          dataBand.DataSource = report.GetDataSource("Orders");
          // connect the databand to the nested group
          mainGroup.Data = dataBand;
    
    
          // now create the nested group
          GroupHeaderBand nestedGroup = new GroupHeaderBand();
          nestedGroup.Height = Units.Millimeters * 10;
          nestedGroup.Name = "NestedGroup";
          nestedGroup.Condition = "[Orders.OrderDate]";
          
          // add it to the main group. Disconnect main group data band first!
          nestedGroup.Data = dataBand;
          mainGroup.NestedGroup = nestedGroup;
    
  • edited 3:57AM
    thanks,disconnect data was the gist

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.