StyleExpr Property

Sets whether the format that is specified in the Style Property is applied to text in a field.

For backward compatibility only: If set to a Boolean true or false, it sets whether the format specified in the Style property is applied to text in a field.

  • Page field controls that are not of type Boolean or BLOB.

This property is not supported in the Microsoft Dynamics NAV Web client or web applications that run on Microsoft Dynamics NAV Portal Framework for Microsoft SharePoint 2010. If the page is displayed in a these display targets, the property is ignored.

You can set StyleExpr to either the name of a variable; a text constant in apostrophes, for example, ‘strong’; or, for backward compatibility, to true or false.

If the StyleExpr property evaluates to true, then the value of the field is formatted as specified by the Style Property. You can set the value to true or false, or you can use a variable that evaluates to true or false. The property's default value is false.

You can use a conditional setting of styles by inserting the conditional code in, for example, the OnAfterGetRecord Trigger. Remember to cover all cases in else branches to avoid incorrect styles. For example: if (MyField = 'abc') then   MyStyleVar := 'Ambiguous' else   MyStyleVar := 'Favorable'

To use a variable for the StyleExpr property, the IncludeInDataSet Property of the variable must be set to Yes.