Intersoft WebGrid Documentation
CustomAggregate Event
See Also  Example Send Feedback
ISNet.WebUI.WebGrid Namespace > WebGrid Class : CustomAggregate Event






Occurs when custom calculation on rows collections are performed.

Syntax

Visual Basic (Declaration) 
<DescriptionAttribute()>
<CategoryAttribute("Behavior")>
Public Event CustomAggregate As CustomAggregateEventHandler
Visual Basic (Usage)Copy Code
Dim instance As WebGrid
Dim handler As CustomAggregateEventHandler
 
AddHandler instance.CustomAggregate, handler
C# 
[DescriptionAttribute()]
[CategoryAttribute("Behavior")]
public event CustomAggregateEventHandler CustomAggregate
Delphi 
public event CustomAggregate: CustomAggregateEventHandler; 
JScript 
In JScript, you can handle the events defined by another class, but you cannot define your own.
Managed Extensions for C++ 
[DescriptionAttribute()]
[CategoryAttribute("Behavior")]
public: __event CustomAggregateEventHandler* CustomAggregate
C++/CLI 
[DescriptionAttribute()]
[CategoryAttribute("Behavior")]
public:
event CustomAggregateEventHandler^ CustomAggregate

Example

 

The following example shows you how to to implement your own aggregate calculation by handling the CustomAggregate event.
C#Copy Code
private void WebGrid1_CustomAggregate(object sender,
ISNet.WebUI.WebGrid.CustomAggregateArgs e)
{
    if (e.Column.DataMember == "Status") 
    {
        WebGridRowCollection rows = e.Rows;
        int count = 0;
        for (int i=0; i < rows.Count; i++) 
        {
            WebGridCell cell = rows[i].Cells[e.Column.Position];
            if (cell.Value.ToString() == "Active")
            {
                count++;
            }
        }
        e.AggregateResult = count;
    }
}

Remarks

Note that you can specify the CustomAggregate to as much columns as you want, the CustomAggregate event will be invoked each time the WebGrid found the specified CustomAggregate Column in the rendering process.

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

©2012 Intersoft Solutions Corp. All Rights Reserved.