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

Display Group Footer Conditionally

5 Answers 445 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 02 Jun 2008, 06:23 PM
I need to display the Group Footer which is a SubTotal of Amount , Grouped by Date only if the Month has more than 1 entry.

For example.

Date
1/1/2008  Amount: !.50
1/2/2008                4.50
Subtotal
January:                   7.00

3/1/2008 Amount: 6.00

So far March, I don't want it to show the Subtotal.   I have SubTotals working,
by using a Grouping field and parsing out the DateName and Month using Sql.

But I need to conditionally display the footer.

Any suggestions would be appreciated,

David

Also -  Is it possible to display a Grand Total.  For some reason the Page Footer does not recognize the Data Field. 



5 Answers, 1 is accepted

Sort by
0
Accepted
Hrisi
Telerik team
answered on 03 Jun 2008, 11:18 AM
Hello David,

You can use ItemDataBound event handler for the GroupFooter section. The code can look something like this:

private void GroupFooter_ItemDataBound(object sender, System.EventArgs e) 
    Telerik.Reporting.Processing.ReportSection footerSection = (Telerik.Reporting.Processing.ReportSection)sender; 
    Telerik.Reporting.Processing.TextBox groupTotal = (Telerik.Reporting.Processing.TextBox)footerSection.Items.Find("groupTotal"true)[0]; 
    int count = int.Parse(groupTotal.Text); 
    if (count < 10) 
    { 
        footerSection.Visible = false
    } 

Additional info can be found here "How do I modify TextBox visibility in the ItemDataBound of another TextBox?"

If you want to calculate Grand Total, place the TextBox in the ReportFooter section. Please take a look at "Understanding Report Sections" to clarify why not to use data fields in Page Header/Footer sections.

Greetings,
Hrisi
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
David
Top achievements
Rank 1
answered on 03 Jun 2008, 04:29 PM
This sounds good, I'm trying it, but I keep getting Index Outside the Bounds
of the Array.   What does "groupTotal" represent? 

Thanks,
David

Meanwhile, I'll check that link...
0
David
Top achievements
Rank 1
answered on 03 Jun 2008, 04:51 PM
OK, I understand footerSection.Items.Find("...") represents the name of the control -  however,   here's the problem.

The Count is being direved from the ReportFooterSection,

The Section that needs to be invisible is the GroupFooterSection.

How can I reference the GroupFooterSection from the ReportFooterSection?

Thanks,
David

Psuedo:
[GroupFooterSection]
[ReportFooterSection]   if(tbNumMonths<=1)
                                             Processing.HidePanel(GroupFooterSection)
0
Hrisi
Telerik team
answered on 05 Jun 2008, 08:05 AM
Hello David,

You can navigate trough Report items hierarchy using properties such as Parent, Report or Items. Every Section or Panel are container objects and you can use Items.Find to search for child items.

Note that in you scenario you have grandTotal in the ReportFooterSection. This is the most outer section in the report and it would be wrong to use the value of grandTotal, because it should always return the same value.

Best wishes,
Hrisi
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
David
Top achievements
Rank 1
answered on 05 Jun 2008, 04:10 PM
Thank you, I managed to pass in a parameter which came from an external query which solved the problem.  I then checked the Parameter's value on the Item_DataBound method of the SubTotal Group and set the visibility accordingly as per your directions below.   Your answer below was most helpful.  Thanks, David
Tags
General Discussions
Asked by
David
Top achievements
Rank 1
Answers by
Hrisi
Telerik team
David
Top achievements
Rank 1
Share this question
or