Skip to main content
Tab

GridViewFormatConditionTopBottom Class

A grid format condition that allows you to highlight top or bottom cell values.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.1.dll

NuGet Package: DevExpress.Web

Declaration

public class GridViewFormatConditionTopBottom :
    GridFormatConditionTopBottom

Remarks

ASPxGridView supports conditional formatting, i.e., automatically applies cell formatting based on the specified rules. The ASPxGridView.FormatConditions property provides access to a collection of rules which are represented by the GridFormatConditionBase class descendants.

Use the GridViewFormatConditionTopBottom object to create a format condition allowing you to highlight top or bottom cell values. The conditional formatting is determined for the column specified by the GridFormatConditionBase.FieldName property. By default, the formatting is applied to the same column. However you can specify the column to which the formatting will be applied using the GridViewFormatConditionTopBottom.ShowInColumn property. The style format, which can be specified by the GridFormatConditionExpressionBase.Format property, is applied to a cell (or row, provided the GridViewFormatConditionTopBottom.ApplyToRow property is set to true) whose value meets the condition specified by the GridFormatConditionTopBottom.Rule property.

When the GridFormatConditionTopBottom.Rule property is set to the BottomItems, BottomPercent, TopItems, or TopPercent values, use the GridFormatConditionTopBottom.Threshold property to specify additional condition information, i.e., the number of items or the percent. The AboveAverage and BelowAverage values do not require additional parameters.

If the GridFormatConditionExpressionBase.Format property is set to Custom, the formatting style can be specified by the GridViewFormatConditionTopBottom.CellStyle or GridViewFormatConditionTopBottom.RowStyle property (based on the GridViewFormatConditionTopBottom.ApplyToRow property value).

Note

The GridViewFormatConditionTopBottom format condition is not in effect in server mode if the GridFormatConditionTopBottom.Rule property is set to GridTopBottomRule.TopItems, GridTopBottomRule.TopPercent, GridTopBottomRule.BottomItems or to GridTopBottomRule.BottomPercent value.

Online Demo

Conditional Formatting

Example

<dx:ASPxGridView runat="server" ... >
        <Columns>...</Columns>
     <FormatConditions>
          <dx:GridViewFormatConditionTopBottom FieldName="UnitPrice" Rule="AboveAverage" Format="RedText" />
          <dx:GridViewFormatConditionHighlight FieldName="Discount" Expression="[Discount] > 0" Format="GreenFillWithDarkGreenText" />
          <dx:GridViewFormatConditionColorScale FieldName="Quantity" Format="BlueWhiteRed" />
          <dx:GridViewFormatConditionIconSet FieldName="Total" Format="Ratings5" />
     </FormatConditions>
</dx:ASPxGridView>
See Also