GrapeCity MultiRow Windows Forms Documentation
ValidateContext Class
Members  Example 


Provides relative context information in the CellValidator.
Object Model
ValidateContext ClassCellPosition StructureGcMultiRow Class
Syntax
Public Class ValidateContext 
Dim instance As ValidateContext
public class ValidateContext 
Remarks
This class provides information when validating the cell. You can get the validated Cell's context information. Use this information to determine the validation result when invoking the CellValidator.Validate method.
Example
The following code example shows how to customize a CellValidator, and add a customized CellValidateAction. This example is part of a larger example available in the CellValidator class.
class MyRequiredFieldValidator : RequiredFieldValidator
        {
            protected override bool Validate(ValidateContext context)
            {
                if (context.EditedFormattedValue != null)
                {
                    string value = context.EditedFormattedValue.ToString();
                    if (value != "NULL")
                    {
                        context.ValidateInfo = "The input value is not NULL";
                        return false;
                    }
                    else
                    {
                        return true;
                    }
                }

                return base.Validate(context);
            }
        }
Private Class MyRequiredFieldValidator
        Inherits RequiredFieldValidator
        Protected Overloads Overrides Function Validate(ByVal context As ValidateContext) As Boolean
            If context.EditedFormattedValue <> Nothing Then
                Dim value As String = context.EditedFormattedValue.ToString()
                If value <> "NULL" Then
                    context.ValidateInfo = "The input value is not NULL"
                    Return False
                Else
                    Return True
                End If
            End If

            Return MyBase.Validate(context)
        End Function
    End Class
Inheritance Hierarchy

System.Object
   GrapeCity.Win.MultiRow.ValidateContext
      GrapeCity.Win.MultiRow.ValidateActionContext

Requirements

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

See Also

Reference

ValidateContext Members
GrapeCity.Win.MultiRow Namespace
CellValidator Class
ValidateActionContext Class

 

 


Copyright © GrapeCity, inc. All rights reserved.