Changing Page_ValidationActive server-side??

G

Guest

I have several RequiredFieldValidator in my page, but I need to do postback,
so I have to disable them temporarily. I do this with Page_ValidationActive
on client-side ("onClick="Page_ValidationActive=false;").
How can I change this property back to true in my server-side code? I need
to do it when I ckick on a server-side button so that now I can validate that
all the textboxes are filled.

Thanks.
 
G

Guest

Howdy,

It's easier to do it via CausesValiadtion property:

<asp:TextBox runat="server" ID="txt1" />
<asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator1"
Text="Error1"
ControlToValidate="txt1" Display="dynamic" EnableClientScript="true" />
<asp:TextBox runat="server" ID="txt2" />
<asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator2"
Text="Error2"
ControlToValidate="txt2" Display="dynamic"
EnableClientScript="true" />
<asp:Button runat="server" ID="btn" Text="submit"
CausesValidation="false" OnClick="btn_Click" />
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,610
Members
45,255
Latest member
TopCryptoTwitterChannels

Latest Threads

Top