Skip to main content
A newer version of this page is available. .

ASPxPivotGrid.CustomGroupInterval Event

Enables grouping axis values, using your own criteria.

Namespace: DevExpress.Web.ASPxPivotGrid

Assembly: DevExpress.Web.ASPxPivotGrid.v18.2.dll

Declaration

public event PivotGridCustomGroupIntervalEventHandler CustomGroupInterval

Event Data

The CustomGroupInterval event's data class is PivotCustomGroupIntervalEventArgs. The following properties provide information specific to this event:

Property Description
Field Gets the field being processed. Inherited from PivotFieldEventArgsBase<T>.
GroupValue Gets or sets a group value.
Value Gets the processed field value.

Remarks

The CustomGroupInterval event is raised for each row or column field whose PivotGridFieldBase.GroupInterval property is set to ‘Custom’.

Objects assigned to the GroupInterval property must be of the same type for all values of a particular field.

Note

The CustomGroupInterval is not supported in server and OLAP modes.

Example

This example shows how to provide a custom criteria used to group axis values. The Custom Group Intervals feature is used to group product names and make the report more readable. The Product axis will show three intervals (“A-J”, “K-S” and “T-Z”).

The ‘Products’ field’s PivotGridFieldBase.GroupInterval property is set to Custom at design-time. The grouping logic is implemented within the ASPxPivotGrid.CustomGroupInterval event handler.

The image below shows the result:

CustomGroupInterval

protected void ASPxPivotGrid1_CustomGroupInterval(object sender, 
    DevExpress.Web.ASPxPivotGrid.PivotCustomGroupIntervalEventArgs e)
{
    if (e.Field.Caption != "Products") return;
    if (Convert.ToChar(e.Value.ToString()[0]) < 'K')
    {
        e.GroupValue = "A-J";
        return;
    }
    if (Convert.ToChar(e.Value.ToString()[0]) > 'J' && Convert.ToChar(e.Value.ToString()[0]) < 'T')
    {
        e.GroupValue = "K-S";
        return;
    }
    if (Convert.ToChar(e.Value.ToString()[0]) > 'S')
        e.GroupValue = "T-Z";
}
See Also