GrapeCity MultiRow Windows Forms Documentation
ValidateInfo Property
Example 


Gets or sets a value that indicates what information is displayed when doing a CellValidateAction.
Syntax
<DefaultValueAttribute()>
Public Property ValidateInfo As String
Dim instance As ValidateContext
Dim value As String
 
instance.ValidateInfo = value
 
value = instance.ValidateInfo
[DefaultValue()]
public string ValidateInfo {get; set;}

Property Value

A System.String value that indicates what information is displayed when doing a CellValidateAction. The default is a null reference (Nothing in Visual Basic).
Remarks
You can set this property to show information to the user if the validation is a failure. Use this value when executing CellValidateAction.
Example
The following code example shows how to customize a CellValidator, and how to 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
CellValidateAction Class

 

 


Copyright © GrapeCity, inc. All rights reserved.