What attribute must be set on a validator control for the validation to work ?
-
Validate
-
ValidateControl
-
ControlToBind
-
ControlToValidate
For validation controls to function, they must know which input control to validate. The ControlToValidate property specifies this target control ID. Option D is correct. Options A, B, and C are not valid ASP.NET validator properties - the validator needs to know what it's validating, which is exactly what ControlToValidate specifies.
To answer this question, you need to understand the purpose of a validator control in web development.
A validator control is used to validate user input on a web form. It checks whether the input matches certain criteria, such as a required field, a specific format, or a range of values. In order for the validation to work correctly, you need to specify the control that should be validated.
The correct attribute that must be set on a validator control for the validation to work is:
D) ControlToValidate
The ControlToValidate attribute is used to specify the ID of the control that needs to be validated. This attribute tells the validator control which input field to check for validation.
Option A) Validate - This option is incorrect because there is no attribute called "Validate" associated with a validator control. Option B) ValidateControl - This option is incorrect because there is no attribute called "ValidateControl" associated with a validator control. Option C) ControlToBind - This option is incorrect because there is no attribute called "ControlToBind" associated with a validator control.
Therefore, the correct answer is D) ControlToValidate. This attribute needs to be set on a validator control to specify the control that needs to be validated.