PropertyCondition class
namespace: Serenity.ComponentModel assembly: Serenity.Net.Core
A condition on the value of another field of a form, which a field is shown, made read only or required by, see VisibleWhenAttribute, ReadOnlyWhenAttribute and RequiredWhenAttribute.
public class PropertyCondition
Public Members
| name | description |
|---|---|
| PropertyCondition() | The default constructor. |
| Field { get; set; } | Gets or sets the name of the field whose value is checked, as the form has it, e.g. a property name. |
| IsNot { get; set; } | Gets or sets whether the condition is the opposite, e.g. met when the field has none of the values, or has no value. |
| Values { get; set; } | Gets or sets the values that meet the condition, any of which the field can have. When there are none, the condition is met when the field has a value, which is one that is not null, an empty string, an empty list or false. Enum values are given as their numbers, as the editors have them. |
| IsMet(…) | Gets whether a value meets the condition, by the same rules as the forms: a value matches one of the values when they are the same as text, e.g. 2 and "2", or true and "true", and a list matches when any of its items does. It can be used to check on the server what a form checks, e.g. that a field required by a condition has a value. |
| static HasValue(…) | Gets whether a value is one, i.e. it is not null, an empty string, an empty list or false. |
| static ToText(…) | Gets the text a value is compared by, as the forms compare them: enum values by their numbers, booleans as true and false, and numbers in the invariant culture. |
See Also
- Source: PropertyCondition.cs