Validation controls not working

Hello there...

can somebody guide me on this…

I have a panel (say, panel1) inside another panel (say, outer-panel)….The panel1 is visible only when a checkbox is checked in the outer-panel.

I have many text boxes in the panel1. I have to put a validation on all the boxes.
I have to enable the validations on certain conditions,say, if textbox 1 is filled only then the required-field validator for textbox 2 should be enabled and vice-versa.
I did write code in the page_load for this.
Code:
if (txt1.Text != "")
            {
                required_txt2.Enabled = true;

            }
            else
            {
                required_txt2.Enabled = false;
            }
            if (txt2.Text != "")
            {
                required_txt1.Enabled = true;
            }
            else
            {
                required_txt1.Enabled = false;
            }

This code does enable the validator but does not show any error if one the textboxes is not filled and the page gets submitted normally.
the asp code for the validators is,
Code:
<asp:RequiredFieldValidator ID="required_txt1" runat="server" ErrorMessage="Please enter the text."
                    ControlToValidate="txt1" EnableClientScript="false" Enabled="false" Display="Dynamic"
                    SetFocusOnError="true" ValidationGroup="Submit">*</asp:RequiredFieldValidator>
<asp:RequiredFieldValidator ID="required_txt2" runat="server" Enabled="false" EnableClientScript="false"
                    ErrorMessage="Please enter the text 2." ControlToValidate="txt2" SetFocusOnError="true"
                    Display="Dynamic" ValidationGroup="Submit">*</asp:RequiredFieldValidator>

Can somebody please tell me what could be the reason…thanks in advance….
 
thank you for the response..I am not sure if I follow you...I am currently running this application on my local system with no IIS....
 
Back
Top