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

Multiple Aggregate="Custom" Columns

9 Answers 373 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dmitry
Top achievements
Rank 1
Dmitry asked on 08 Sep 2008, 09:37 PM
I'm having a RadGrid with two columns which need to display custom Aggregate result.$0$0$0$0In RadGrid each column with Aggregate = "Custom" column triggers event OnCustomAggregate and passes GridCustomAggregateEventArgs object to it. $0$0$0$0$0However I couldn't find any property within GridCustomAggregateEventArgs object that would allow me to distinguish between several columns within one GridItem. $0$0It only contains a reference to the current GridItem object but not a particular cell within it which actually triggers the call. $0$0Is there still any way to know within the event handler to know which column the current aggregate=custom call refers to?$0$0$0$0$0$0Protected Sub rgSummary_CustomAggregate(ByVal sender As System.Object, ByVal e As Telerik.Web.UI.GridCustomAggregateEventArgs) Handles rgSummary.CustomAggregate$0$0...........................$0$0    End Sub$0$0$0End Class$0$0

9 Answers, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 10 Sep 2008, 12:23 PM
Hello Dmitry,

Unfortunately it is a limitation for now to have more that one column with Custom aggregate. We will fix that in our next version.
Your Telerik points are updated for bringing us to this issue.

Find more information about grid footer aggregates here.

Please excuse us for the inconvenience.

Sincerely yours,
Iana
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Josh Fuller
Top achievements
Rank 1
answered on 27 Apr 2010, 11:15 PM
Is this possible yet?
0
Iana Tsolova
Telerik team
answered on 28 Apr 2010, 01:04 PM
Hi Josh,

Indeed, the current RadGrid for ASP.NET AJAX does support having Custom aggregate for more than one column.
Try it out and let me know if any issues arise.

Best wishes,
Iana
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Josh Fuller
Top achievements
Rank 1
answered on 28 Apr 2010, 04:10 PM
I wasn't able to find a demo on the site.  Are you now able to specify more than one custom aggregate function, or do you still define one function and determine which column is calling it within?  An example would be great.
0
Yavor
Telerik team
answered on 29 Apr 2010, 12:25 PM
Hi Josh,

Attached to this message, is a small application, which handles a similar setup, where the custom aggregate is performed on two columns.
I hope this gets you started properly.

Regards,
Yavor
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Markus
Top achievements
Rank 2
answered on 13 Sep 2011, 02:00 PM
Dear Yavor

I looked at your example the problem is that I need to return two different values to the two colums.
Your code seems to return the same value to the both columns.

-----------------

I fill on the ondatabound event a lable with some values on two gridtemplatecolums. I now want to add up all values in the footer.

The values are not in the database but calculated in codebehind.

Any idea?

Kind regards
Markus
0
Marc Fearby
Top achievements
Rank 1
answered on 14 Sep 2011, 01:58 AM
I'm using GridTemplateColumns so this example is a little more complex than you'd need for an ordinary grid, but I couldn't find any explicit examples for this scenario, so perhaps this will help you (and perhaps others):

Protected Sub GridApplied_CustomAggregate(sender As Object, e As Telerik.Web.UI.GridCustomAggregateEventArgs) Handles GridApplied.CustomAggregate
        Dim field As String = DirectCast(e.Column, Telerik.Web.UI.GridTemplateColumn).UniqueName
        If field = "Whatever1" Then
            Dim total As Integer = 0
            For Each item As GridDataItem In GridApplied.MasterTableView.Items
                If Not item.IsInEditMode Then
                    Dim status As Label = DirectCast(item.FindControl("Whatever1Label"), Label)
                    If Not status.Text <> "some text" Or Not status.Text <> "other text" Then
                        total += 1
                    End If
                End If
            Next
            e.Result = total
        ElseIf field = "Whatever2" Then
            Dim total As Integer = 0
            For Each item As GridDataItem In GridApplied.MasterTableView.Items
                If Not item.IsInEditMode Then
                    Dim status As Label = DirectCast(item.FindControl("Whatever2Label"), Label)
                    If Not status.Text <> "something you're looking for" Then
                        total += 1
                    End If
                End If
            Next
            e.Result = total
        End If
    End Sub
0
Markus
Top achievements
Rank 2
answered on 15 Sep 2011, 03:32 PM
@Marc

Thanks a lot. This is great, exactely what I needed. Thanks again for taking the time and sharing.

@Telerik

PLEASE: Include this in your docu!!!!

Markus
0
Marc Fearby
Top achievements
Rank 1
answered on 15 Sep 2011, 11:54 PM
I find there are insufficient examples in most documentation (including ExtJS, which I'm in the process of switching to) but the whole way ASP.NET handles AJAX and scenarios such as the above is what drives me even more crazy. The sheer number of code lines to achieve something so simple is just ridiculous in ASP.NET WebForms. It's an out-dated Windows application programming model that belongs to the pre-AJAX era and needs to be thrown out and replaced with something less wordy. Mind you, I'm not throwing out .NET entirely; I'll probably use WCF RESTful web services with ExtJS, but as far as MS AJAX/ASP.NET WebForms go, they'll soon be history for me (and so therefore, by definition, will be my use of Telerik Rad Controls, though I might keep reporting for the time being).
Tags
Grid
Asked by
Dmitry
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Josh Fuller
Top achievements
Rank 1
Yavor
Telerik team
Markus
Top achievements
Rank 2
Marc Fearby
Top achievements
Rank 1
Share this question
or