Skip to main content
Tab

GridViewFormatConditionHighlight Class

A grid format condition that allows you to highlight cell values based on a custom expression.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.2.dll

Declaration

public class GridViewFormatConditionHighlight :
    GridFormatConditionHighlight

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 GridViewFormatConditionHighlight object to create a format condition allowing you to highlight cell values based on a custom expression. 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 GridViewFormatConditionHighlight.ShowInColumn property. The style format, which can be specified by the GridFormatConditionExpressionBase.Format property, is applied to a cell (or row, provided the GridViewFormatConditionHighlight.ApplyToRow property is set to true) whose value meets the condition specified by the GridFormatConditionHighlight.Rule property. When this property is set to Expression, use the GridFormatConditionHighlight.Expression property to specify a custom rule expression.

If the GridFormatConditionExpressionBase.Format property is set to Custom, the formatting style can be specified by the GridViewFormatConditionHighlight.CellStyle or GridViewFormatConditionHighlight.RowStyle property (based on the GridViewFormatConditionHighlight.ApplyToRow property 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