GrapeCity.Win.MultiRow Namespace : CellValidator Class |
Public MustInherit Class CellValidator Implements INamedObject
Dim instance As CellValidator
public abstract class CellValidator : INamedObject
The GcMultiRow control provides the capability to validate the Cell value with CellValidator. You can add CellValidators to the Cell's Cell.Validators collection. You can also specify the CellValidator's Actions, in each CellValidateAction. Use the DoActionReason property to indicate when the action occurs. If the validation result fails when a CellValidator occurs, all CellValidateActions in this CellValidator are performed to notify the user.
There are several pre-defined CellValidators available in the GcMultiRow control:
If you want to customize a CellValidator, you can inherit the CellValidator class and override the Validate method. Be sure to invoke the base class's Clone method when you override the Clone method.
void setRangeValidator_Click(object sender, EventArgs e) { Template template = Template.CreateGridTemplate(1); //Create one RangeValidator to validate whether the committed value is in range. RangeValidator rangValidator = new RangeValidator(); //Set the RequiredType first, then set other Properties. rangValidator.RequiredType = typeof(int); rangValidator.MinValue = 5; rangValidator.MaxValue = 10; rangValidator.NullIsValid = false; LineNotify lineNotifyAction = new LineNotify(); //When you end edit mode, the action is done (press Enter key) lineNotifyAction.DoActionReason = ValidateReasons.EndEdit; lineNotifyAction.LineColor = Color.Red; rangValidator.Actions.Add(lineNotifyAction); template.Row.Cells[0].Validators.Add(rangValidator); this.gcMultiRow1.Template = template; label.Text = "The RangeValidator's MinValue is 5, MaxValue is 10, input 4 (not in the range) in one cell, press Enter key to trigger validation (DoActionReason is EndEdit), a red underline is shown."; }
Private Sub setRangeValidator_Click(ByVal sender As Object, ByVal e As EventArgs) Handles setRangeValidator.Click Dim template As Template = template.CreateGridTemplate(1) 'Create one RangeValidator to validate whether the committed value is in range. Dim rangValidator As New RangeValidator() 'Set the RequiredType first, then set other Properties. rangValidator.RequiredType = GetType(Integer) rangValidator.MinValue = 5 rangValidator.MaxValue = 10 rangValidator.NullIsValid = False Dim lineNotifyAction As New LineNotify() 'When you end edit mode, the action is done (press Enter key) lineNotifyAction.DoActionReason = ValidateReasons.EndEdit lineNotifyAction.LineColor = Color.Red rangValidator.Actions.Add(lineNotifyAction) template.Row.Cells(0).Validators.Add(rangValidator) Me.gcMultiRow1.Template = template label.Text = "The RangeValidator's MinValue is 5, MaxValue is 10, input 4 (not in range) in one cell, press Enter key to trigger validation (DoActionReason is EndEdit), a red underline is shown." End Sub
System.Object
GrapeCity.Win.MultiRow.CellValidator
GrapeCity.Win.MultiRow.CompareStringValidator
GrapeCity.Win.MultiRow.CompareValueBaseValidator
GrapeCity.Win.MultiRow.EncodingValidator
GrapeCity.Win.MultiRow.ExcludeListValidator
GrapeCity.Win.MultiRow.IncludeListValidator
GrapeCity.Win.MultiRow.PairCharValidator
GrapeCity.Win.MultiRow.RangeValidator
GrapeCity.Win.MultiRow.RegularExpressionValidator
GrapeCity.Win.MultiRow.RequiredFieldValidator
GrapeCity.Win.MultiRow.RequiredTypeValidator
GrapeCity.Win.MultiRow.SurrogateCharValidator
GrapeCity.Win.MultiRow.TextLengthValidator
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
CellValidator Members
GrapeCity.Win.MultiRow Namespace
CellValidateAction Class
DoActionReason Property
ValidateContext Class
ExcludeListValidator Class
IncludeListValidator Class
RequiredTypeValidator Class
RequiredFieldValidator Class
RangeValidator Class
CompareValueValidator Class
CompareCellValidator Class
SurrogateCharValidator Class
PairCharValidator Class
RegularExpressionValidator Class