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

Count Filtered Rows

1 Answer 128 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Stephen McDaniel
Top achievements
Rank 1
Stephen McDaniel asked on 10 Jun 2008, 04:25 PM
I am wondering how I can find out the number of rows in a SubReport after filtering is applied.  I want to know whether all rows of a given SubReport are filtered out (leaving an empty report) so that I can hide that particular SubReport.  It's easy enough to see how many rows I get back from the database, but until the Filtering is processed, I don't really know how many rows will display.

This seems like an easy task, but so far I'm stumpted.

1 Answer, 1 is accepted

Sort by
0
Accepted
Milen | Product Manager @DX
Telerik team
answered on 12 Jun 2008, 08:10 AM
Hello Stephen McDaniel,

Add the following event handlers and private field in your subreport to show and hide it according to the count of rows.

        private int rowCount = 0;
      
          //eventhandler for the whole report
        private void DetailDBReport_ItemDataBinding(object sender, System.EventArgs e)
        {
            this.rowCount = 0;
        }
          //eventhandler for the detail section
        private void detail_ItemDataBinding(object sender, System.EventArgs e)
        {
            this.rowCount++;
        }

        private void DetailDBReport_ItemDataBound(object sender, System.EventArgs e)
        {
            Telerik.Reporting.Processing.Report report = (Telerik.Reporting.Processing.Report)sender;
            report.Visible = this.rowCount != 0;
        }

Write us if you need further assistance.

Best wishes,
Milen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
General Discussions
Asked by
Stephen McDaniel
Top achievements
Rank 1
Answers by
Milen | Product Manager @DX
Telerik team
Share this question
or