ValidatorCollection Class
Assembly: System.Web (in system.web.dll)
Each ValidatorCollection reference is associated with a validation server control contained on the requested page. These controls add themselves to this collection when the Init event of the Page object is handled. They remove themselves when the Unload event of the Page object is handled. The Page class inherits both of these methods from the Control class.
You can access this collection, its methods, and its properties through the Page.Validators property. If the tested condition of any validator in this collection fails, the Page.IsValid property is set to false.
The following code example demonstrates how to access the collection through the Page.Validators property and use the GetEnumerator method to iterate through the values.
// Get 'Validators' of the page to myCollection.
ValidatorCollection myCollection = get_Validators();
// Get the Enumerator.
IEnumerator myEnumerator = myCollection.GetEnumerator();
// Print the values in the ValidatorCollection.
String myStr = " ";
while (myEnumerator.MoveNext()) {
myStr += System.Convert.ToString(myEnumerator.get_Current());
myStr += " ";
}
messageLabel.set_Text(myStr);
- AspNetHostingPermission for operating in a hosted environment. Demand value: LinkDemand; Permission value: Minimal.