How to display total records in the header or footer?

1 Answer 286 Views
Binding Report Designer - Web Report Viewer - HTML5
Cris RS
Top achievements
Rank 1
Cris RS asked on 10 Apr 2023, 07:06 PM

I've a very simple report where has only one detail table is named: "table1".
A textbox named: textBoxTotalRecords should display the number of rows/records displayed in the details part

I tried to use something like setting this:  textBoxTotalRecords.value = RowNumber("table1") in the textbox value but not success. (picture)

If tried to force something like in the detail_ItemDataBound:
textBoxTotalRecords.value =666; it doesn't work

Even I created a couple of custom functions that hold the total number of records but I'm unable to assign them through (textBoxTotalRecords_ItemDataBinding or textBoxTotalRecords_ItemDataBound) because:

I found that these events
textBoxTotalRecords_ItemDataBinding
textBoxTotalRecords_ItemDataBound

Are fired before this:
detail_ItemDataBound

So Is not possible to assign the number of records got it in detail_ItemDataBound

Which is the simple way to display the number of records? is out there a demo of how to handle this properly?

 

Thank you

1 Answer, 1 is accepted

Sort by
0
Momchil
Telerik team
answered on 13 Apr 2023, 11:27 AM

Hi Cris,

In my opinion, the two simplest ways to get the total number of records are the following.

1. Add a new row to the table that is outside of its detail group (a footer row in a sense) and use the Count aggregate function.

2. If you want to display the total outside of the table's body, you can do the following.

2.1 Move the table and the textbox to the Report Header/Footer section.

2.3 Assign the data source to the report itself.

2.4 Use the Count aggregate function in the textbox

2.5 Bind the data source of the table to the data source of its parent item (the report header/footer section).

For your convenience, I am attaching a sample report that illustrates both of the above.

Best Regards,
Momchil
Progress Telerik

Brand new Telerik Reporting course in Virtual Classroom - the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products. Check it out at https://learn.telerik.com/.
Tags
Binding Report Designer - Web Report Viewer - HTML5
Asked by
Cris RS
Top achievements
Rank 1
Answers by
Momchil
Telerik team
Share this question
or