This is a migrated thread and some comments may be shown as answers.

Urgent: How do I add goup footer for total in a table.

0 Answers 153 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Ranjan
Top achievements
Rank 1
Ranjan asked on 23 Aug 2012, 11:19 AM
Telerik Reporting:
I have urgent requirement to make a automated reporting system and I am trying to create a report programmatically using telerik.
So, far I was able to create group but not able to add group footer so that I can show sum, avg etc.
My code is:
Telerik.Reporting.TextBox txtGroupHeader = new Telerik.Reporting.TextBox();
            Telerik.Reporting.TextBox txtGroupTotal;// = new Telerik.Reporting.TextBox();
            toggleVisibilityAction1 = new Telerik.Reporting.ToggleVisibilityAction();

            txtGroupHeader.Action = toggleVisibilityAction1;
            toggleVisibilityAction1.DisplayExpandedMark = false;

            // Required for telerik Reporting designer support

            InitializeComponent();

            TableGroup group = new TableGroup();
            Telerik.Reporting.TableGroup tableGroup4 = new Telerik.Reporting.TableGroup();
            Telerik.Reporting.TableGroup tableGroup5 = new Telerik.Reporting.TableGroup();
            group.Name = "Season";
            group.Groupings.AddRange(new Telerik.Reporting.Grouping[] {
            new Telerik.Reporting.Grouping("=Fields.Season")});
            group.Sortings.AddRange(new Telerik.Reporting.Sorting[] {
            new Telerik.Reporting.Sorting("=Fields.Season", Telerik.Reporting.SortDirection.Asc)});

            txtGroupHeader.Name = "txtGroupHeader";
            txtGroupHeader.Size = new Telerik.Reporting.Drawing.SizeU(Telerik.Reporting.Drawing.Unit.Cm(3.9314577579498291D), Telerik.Reporting.Drawing.Unit.Cm(0.43585944175720215D));<br>
            txtGroupHeader.Style.BackgroundColor = System.Drawing.Color.Red;
            txtGroupHeader.Style.BorderStyle.Bottom = Telerik.Reporting.Drawing.BorderType.Solid;
            txtGroupHeader.Style.Color = System.Drawing.Color.White;
            txtGroupHeader.Style.Font.Bold = true;
            txtGroupHeader.StyleName = "";
            txtGroupHeader.Value = "=Fields.Season";
            tableGroup4.Groupings.AddRange(new Telerik.Reporting.Grouping[] {
            new Telerik.Reporting.Grouping(null)});
            group.Sortings.AddRange(new Telerik.Reporting.Sorting[] {
            new Telerik.Reporting.Sorting("=Fields.Season", Telerik.Reporting.SortDirection.Asc)});
            tableGroup4.Name = "Details";
            tableGroup5.Name = "Group1s";
            //group.ChildGroups.Add(tableGroup4);
            //group.ChildGroups.Add(tableGroup5);
            //this.table1.Body.Rows.Add(new Telerik.Reporting.TableBodyRow(Telerik.Reporting.Drawing.Unit.Cm(1)));<br>
            this.table1.Corner.SetCellContent(0, 0, txtGroupHeader);
            this.table1.Items.Add(txtGroupHeader);
            group.ReportItem = txtGroupHeader;
            //Remove the detail group
            TableGroup detailGroup = table1.RowGroups[0];
            table1.RowGroups.Clear();
            //detailGroup.Visible = false;
            toggleVisibilityAction1.Targets.AddRange(new Telerik.Reporting.IToggleVisibilityTarget[] {
            detailGroup});
            //Add the detail group as a child to the AgeGroup (nest it)
            group.ChildGroups.Add(detailGroup);
            table1.RowGroups.Add(group)
;
---------------------

I tried finding help with visual studio generated code but to no avail. Please help as it is urgent.

No answers yet. Maybe you can help?

Tags
General Discussions
Asked by
Ranjan
Top achievements
Rank 1
Share this question
or