What attribute must be set on a validator control for the validation to work ?
-
Validate
-
ValidateControl
-
ControlToBind
-
ControlToValidate
Validator controls in ASP.NET require the ControlToValidate attribute to specify which input control they validate. This links the validator to its target control. Without this attribute, the validator cannot determine which control's value to check. Validate, ValidateControl, and ControlToBind are not valid attributes for validator controls.
To answer this question, let's review each option:
Option A) Validate - This option is incorrect because there is no attribute called "Validate" for a validator control.
Option B) ValidateControl - This option is incorrect because there is no attribute called "ValidateControl" for a validator control.
Option C) ControlToBind - This option is incorrect because there is no attribute called "ControlToBind" for a validator control.
Option D) ControlToValidate - This option is correct because the "ControlToValidate" attribute must be set on a validator control for the validation to work. This attribute specifies the ID of the control that should be validated.
Therefore, the correct answer is option D) ControlToValidate.