Class GridCellValidateValueInfo
Defines the class that provides a GridStyleInfoSubObject object for validation of text entry in a cell.
Each property in this sub object can be configured individually. Properties that have not been initialized will inherit default values from a base style.
Inheritance
Implements
Inherited Members
Namespace: Syncfusion.Windows.Forms.Grid
Assembly: Syncfusion.Grid.Windows.dll
Syntax
public class GridCellValidateValueInfo : GridStyleInfoSubObject, ICustomTypeDescriptor, IDisposable, IStyleInfo, ISupportInitialize, IFormattable, IConvertible, IXmlSerializable, IStyleInfoSubObject
Examples
The following code changes validation information for cells:
model[rowIndex, 1].Text = "Positive numbers";
RowStyles[rowIndex].CustomStyleProperties.Add(new GridValidateNumberStyleProperty(true, 1, float.NaN, "Please enter a number greater than 0!"));
model.RowStyles[rowIndex].ValidateValue.NumberRequired = true;
model.RowStyles[rowIndex].ValidateValue.Minimum = 0;
model.RowStyles[rowIndex].ValidateValue.Maximum = float.NaN;
model.RowStyles[rowIndex].ValidateValue.ErrorMessage = "Please enter a number greater than 0!";
rowIndex++;
model[rowIndex, 1].Text = "Validation (1-100 valid range)";
model.RowStyles[rowIndex].ValidateValue = new GridCellValidateValueInfo(true, 1, 100, "Please enter a number between 1 and 100!");
Constructors
GridCellValidateValueInfo()
Initializes a new instance of the GridCellValidateValueInfo class.
Declaration
public GridCellValidateValueInfo()
GridCellValidateValueInfo(StyleInfoSubObjectIdentity)
Initializes a new GridCellValidateValueInfo object and associates it with an existing GridStyleInfoSubObjectIdentity.
Declaration
public GridCellValidateValueInfo(StyleInfoSubObjectIdentity identity)
Parameters
Type | Name | Description |
---|---|---|
StyleInfoSubObjectIdentity | identity | A GridStyleInfoSubObjectIdentity that holds the identity for this GridCellValidateValueInfo. |
GridCellValidateValueInfo(StyleInfoSubObjectIdentity, GridCellValidateValueInfoStore)
Initializes a new GridCellValidateValueInfo object and associates it with an existing GridStyleInfoSubObjectIdentity.
Declaration
public GridCellValidateValueInfo(StyleInfoSubObjectIdentity identity, GridCellValidateValueInfoStore store)
Parameters
Type | Name | Description |
---|---|---|
StyleInfoSubObjectIdentity | identity | A GridStyleInfoSubObjectIdentity that holds the identity for this GridCellValidateValueInfo. |
GridCellValidateValueInfoStore | store | A GridCellValidateValueInfoStore that holds data for this GridCellValidateValueInfo. All changes in this style object will saved in the GridCellValidateValueInfoStore object. |
GridCellValidateValueInfo(Boolean, Double, Double, String)
Initializes a new instance of the GridCellValidateValueInfo class with specified validating criteria.
Declaration
public GridCellValidateValueInfo(bool numberRequired, double minimum, double maximum, string errorMessage)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | numberRequired | IfTrueOnly number is allowed; Otherwise Falsefor any other characters. |
System.Double | minimum | The minimum value allowed for the cell. |
System.Double | maximum | The maximum value allowed for the cell. |
System.String | errorMessage | A error message to be displayed if entered text does not meet criteria. |
Properties
Default
Gets a default value ofGridCellValidateValueInfo to be used with a default style.
Declaration
public static GridCellValidateValueInfo Default { get; }
Property Value
Type |
---|
GridCellValidateValueInfo |
Remarks
The Default of the GridStyleInfo class will return the validation info that this method generates through its overridden version of GetDefaultStyle().
Default settings are:
Property | Value. |
---|---|
NumberRequired | False. |
Minimum | Double.MinValue. |
Maximum | Double.MaxValue. |
ErrorMessage | "Value is out of range". |
ErrorMessage
Gets or sets the Error message value allowed for the cell.
Declaration
public string ErrorMessage { get; set; }
Property Value
Type |
---|
System.String |
HasErrorMessage
Gets a value indicating whether ErrorMessage property is initialized.
Declaration
public bool HasErrorMessage { get; }
Property Value
Type |
---|
System.Boolean |
HasMaximum
Gets a value indicating whether Maximum property is initialized.
Declaration
public bool HasMaximum { get; }
Property Value
Type |
---|
System.Boolean |
HasMinimum
Gets a value indicating whether Minimum property is initialized.
Declaration
public bool HasMinimum { get; }
Property Value
Type |
---|
System.Boolean |
HasNumberRequired
Gets a value indicating whether NumberRequired property is initialized.
Declaration
public bool HasNumberRequired { get; }
Property Value
Type |
---|
System.Boolean |
Maximum
Gets or sets the maximum value allowed for the cell.
Declaration
public double Maximum { get; set; }
Property Value
Type |
---|
System.Double |
Minimum
Gets or sets the minimum value allowed for the cell.
Declaration
public double Minimum { get; set; }
Property Value
Type |
---|
System.Double |
NumberRequired
Gets or sets a value indicating whether numeric entry is allowed. True if only numeric entry is allowed; false if any characters are allowed.
Declaration
public bool NumberRequired { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | IfTrueOnly numbers are allowed;Otherwise Falsefor any other characters. |
Methods
GetDefaultStyle()
Overrides and returns the Default
Declaration
protected override StyleInfoBase GetDefaultStyle()
Returns
Type | Description |
---|---|
StyleInfoBase | A GridCellValidateValueInfo object with default values. |
Overrides
MakeCopy(StyleInfoBase, StyleInfoProperty)
Makes an exact copy of the current object.
Declaration
public override IStyleInfoSubObject MakeCopy(StyleInfoBase newOwner, StyleInfoProperty sip)
Parameters
Type | Name | Description |
---|---|---|
StyleInfoBase | newOwner | The new owner style object for the copied object. |
StyleInfoProperty | sip | Identifier for this object. |
Returns
Type | Description |
---|---|
IStyleInfoSubObject | Copy of current object. |
Overrides
ResetErrorMessage()
Resets the ErrorMessage property.
Declaration
public void ResetErrorMessage()
ResetMaximum()
Resets the Maximum property.
Declaration
public void ResetMaximum()
ResetMinimum()
Resets the Minimum property.
Declaration
public void ResetMinimum()
ResetNumberRequired()
Resets the NumberRequired property.
Declaration
public void ResetNumberRequired()