Common property of validation control - Validation Control - ControlToValidate

Q.  _____________is a property common in every validation control.
- Published on 16 Jun 15

a. ValidationExpression
b. InitialValue
c. ValueToCompare
d. ControlToCompare
e. ControlToValidate

ANSWER: ControlToValidate
 

    Discussion

  • Digvijay   -Posted on 21 Oct 15
    ControlToValidate property is common to validation controls. If you forget to set this property then you will get compile time error. This property enables you to attach the validation control to any other web server control.
    Example:
    <body>
    <form id=”form1” runat=”server”>
    <asp:TextBox id=”txtQuantity” Runat=”server” />
    <asp:RequiredFieldValidator id=”reqProductQuantity”
    ControlToValidate=” txtQuantity” Text=”(Required)” Display=”Dynamic”
    Runat=”server” />
    </form>
    </body>

Post your comment / Share knowledge


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)