Validation in code behind
Use this information to override the ValidateForm method, which prevents a form from being submitted by the user.
The following code snippet shows an example of how to achieve this.
public override bool ValidateForm(out string errorMessage)
{
bool isValid = base.ValidateForm(out errorMessage);
if (isValid)
{
// Do additional check here
if (ValidatingTextBox1.Text == "55")
{
isValid = false;
errorMessage = "Oh no! Not 55!";
}
}
return isValid;
}