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

Grid Page Total + DataSource Total

2 Answers 53 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jako
Top achievements
Rank 1
Jako asked on 23 May 2012, 12:38 PM
Hi there

I have a total column on one of my grid columns, by using the following code:
applicationValueTotal += Double.Parse(dataItem["ApplicationValue"].Text);
.
.
.
GridFooterItem footerItem = (GridFooterItem)e.Item;           
footerItem["ApplicationValue"].Text = "R " + applicationValueTotal;
This works great, but it only gives me the total of the current "visible" records.

I want it to show me the results of the whole dataset at that point and then a sub total for the current visible records.
I also use filters so basically I would like the following:

for example a total of 50 records, 10 per page
full dataset on first page load: sub total = applicationValueTotal Grand Total = 50 records' applicationValue

filter applied: sub total = applicationValueTotal Grand Total = x records returned' applicationValue

I can't query this directly out of the database as client side filters might be applied.

Any ideas?

2 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 25 May 2012, 05:33 PM
Hi Jako,

You can use RadGrid footer's default aggregates as demonstrated in this demo:
Grid / Footer Aggregates

I have attached a sample RadGrid page where I implemented the desired scenario. Please give it a look and try to apply this approach to your own project.

Greetings,
Eyup
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Jako
Top achievements
Rank 1
answered on 28 May 2012, 01:40 PM
Hi Eyup

Thanks, it works just as expected.
Tags
Grid
Asked by
Jako
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Jako
Top achievements
Rank 1
Share this question
or