GrapeCity MultiRow Windows Forms Documentation
EditedFormattedValue Property (ValidateContext)
Example 


Gets a value that indicates the validated value.
Syntax
Public ReadOnly Property EditedFormattedValue As Object
Dim instance As ValidateContext
Dim value As Object
 
value = instance.EditedFormattedValue
public object EditedFormattedValue {get;}

Property Value

A System.Object value that indicates the validated value.
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 for 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
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 Class
ValidateContext Members

 

 


Copyright © GrapeCity, inc. All rights reserved.