3
Answers

Validation controls not working

suman biswas

suman biswas

14y
2.8k
1
I was playing around with some validation controls and all of a sudden all validation controls on my page stopped working, any idea what i could have screwed up?

        <tr>
                <td class="style2">
                    &nbsp;</td>
                <td class="style6">
                    First Name / Last Name</td>
                <td class="style10">
                    &nbsp;</td>
                <td class="style19">
                    <asp:TextBox ID="Firstname" runat="server"></asp:TextBox>
&nbsp;
                    <asp:TextBox ID="Lastname" runat="server"></asp:TextBox>

                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
                        ErrorMessage="First name is empty." ControlToValidate="Firstname" ></asp:RequiredFieldValidator>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
                        ErrorMessage="Last name is empty." ControlToValidate="Lastname" ></asp:RequiredFieldValidator>
                </td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style2">
                    &nbsp;</td>
                <td class="style6">
                    Handphone</td>
                <td class="style10">
                    &nbsp;</td>
                <td class="style19">
                    <asp:TextBox ID="Handphone" runat="server"></asp:TextBox>

                    <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server"
                        ErrorMessage="Handphone number is empty." ControlToValidate="handphone" ></asp:RequiredFieldValidator>
                </td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style2">
                    &nbsp;</td>
                <td class="style6">
                    Password</td>
                <td class="style10">
                    &nbsp;</td>
                <td class="style19">
                    <asp:TextBox ID="Password1" runat="server"></asp:TextBox>
                    <asp:CustomValidator ID="passval" runat="server"
                        ControlToValidate="Password2" ErrorMessage="Password cannot be empty."
                        ValidateEmptyText="True"></asp:CustomValidator>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="Password1" ErrorMessage="RequiredFieldValidator"></asp:RequiredFieldValidator>
                    <asp:CompareValidator ID="CompareValidator1" runat="server" ControlToValidate="Password1" ControlToCompare="Password2"
                        ErrorMessage="CompareValidator"></asp:CompareValidator>
                </td>
                <td>
                    &nbsp;</td>
            </tr>
Answers (3)