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