Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize

Validate Method (Common)

.NET Framework 1.1

Performs control validation, and then sets the IsValid property based on the results of the validation.

public virtual void Validate()

Inheritance

The following is a list of the classes that inherit the Validate method from the BaseValidator class.

Remarks

The Validate method causes the IsValid property of the control to be set to true or false, depending on the outcome of the validation test.

Example

The following example demonstrates how to use the Validate method to validate that the text entered by a user falls within the permitted range.

Sub OnCmdClick(sender As Object, e As EventArgs)
   RequiredFieldValidator1.Validate()
   If Page.IsValid Then
      ActiveForm = Form2
   End If
End Sub 

[C#]

void OnCmdClick(Object sender, EventArgs e)
{
   RequiredFieldValidator1.Validate();
   if (Page.IsValid)
     ActiveForm = Form2;
}  

See Also

Applies to: BaseValidator Class

Show:
© 2015 Microsoft