ValidatorCollection.Add(IValidator) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Adds the specified validation server control to the ValidatorCollection collection.
public:
void Add(System::Web::UI::IValidator ^ validator);
public void Add (System.Web.UI.IValidator validator);
member this.Add : System.Web.UI.IValidator -> unit
Public Sub Add (validator As IValidator)
Parameters
- validator
- IValidator
The validation server control to add.
Examples
The following code example demonstrates how to use the Add method.
Controls.Add(myForm);
myForm.Controls.Add(myLabel1);
myForm.Controls.Add(myTextBox);
myForm.Controls.Add(myButton);
this.Validators.Add(myRequiredFieldValidator);
myForm.Controls.Add(myLabel);
myForm.Controls.Add(myRequiredFieldValidator);
Controls.Add(myForm)
myForm.Controls.Add(myLabel1)
myForm.Controls.Add(myTextBox)
myForm.Controls.Add(myButton)
Me.Validators.Add(myRequiredFieldValidator)
myForm.Controls.Add(myLabel)
myForm.Controls.Add(myRequiredFieldValidator)
Remarks
When added to the ValidatorCollection collection of a Page object through the Validators property, the IValidator implementation takes part in validation. Its Validate method is called together with the Validate methods of all other validators. All validators then share in determining whether the Page object as a whole is valid.
Applies to
See also
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기