Skip to main content
Tab

GridFormatConditionHighlight.Expression Property

Gets or sets the expression used to format grid cells.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.2.dll

Declaration

[DefaultValue("")]
public string Expression { get; set; }

Property Value

Type Default Description
String String.Empty

A String value specifying the expression.

Remarks

When the GridFormatConditionHighlight.Rule property is set to Expression, use the Expression property to specify a custom expression used to format grid cells.

The Expression property value is a string that, when parsed and processed, evaluates some value. The Expression property can consist of column/field names, constants, operators, and functions. Column/field names must be wrapped with brackets. To learn more about available operators and functions, refer to the Criteria Language Syntax and Criteria Operators topics.

Example

...
{
    CardViewFormatConditionColorScale Format1 = new CardViewFormatConditionColorScale();
    Format1.FieldName = "Discount";
    Format1.Format = GridConditionColorScaleFormat.GreenYellow;
    Format1.MinimumValue = 0.15;
    Format1.MaximumValue = 0.25;

    CardViewFormatConditionHighlight Format2 = new CardViewFormatConditionHighlight();
    Format2.Format = GridConditionHighlightFormat.Custom; 
    Format2.CardStyle.BackColor = Color.Orange;
    Format2.ApplyToCard = true;
    Format2.Rule = GridConditionRule.Expression;
    Format2.Expression = "[Quantity] < 50";
    Format2.FieldName = "Quantity";

    CardViewFormatConditionTopBottom Format3 = new CardViewFormatConditionTopBottom();
    Format3.FieldName = "UnitPrice";
    Format3.Format = GridConditionHighlightFormat.BoldText;
    Format3.Rule = GridTopBottomRule.TopItems;
    Format3.Threshold = 10;

    ASPxCardView1.FormatConditions.Add(Format1);
    ASPxCardView1.FormatConditions.Add(Format2);
    ASPxCardView1.FormatConditions.Add(Format3);
}
See Also