Disable ASP.NET Form validators using Jquery button click

I have created a simple login page, using ASP.NET 4.5, which has the standard RequiredField validators, assigned to the username and password.

I'm using asp.net identity 1.0 to validate the user, which unfortunately, out of the box, doesnt offer a reset / lost password fucntion, so I am having to roll out my own version.

The problem, I am facing, is being able to disable to validators, when the user clicks the 'Reset Password' button. The button, calls a WebMethod, which in turns, calls a method to actually do the resetting.

Below is what I have, which isn't working at all. In fact, the console.log isnt even being fired.

<div class="form-group">
								<div class="col-sm-12">
									<div class="input-group">
										<span class="input-group-addon"><i class="fa fa-user"></i></span>
                                        <asp:TextBox runat="server" ID="userName" CssClass="form-control" placeholder="Username.." />
                                    <asp:RequiredFieldValidator runat="server" ControlToValidate="userName"
                                            CssClass="text-danger" ErrorMessage="The user name field is required."/>
							<div class="form-group">
								<div class="col-sm-12">
									<div class="input-group">
										<span class="input-group-addon"><i class="fa fa-lock"></i></span>
                                        <asp:TextBox runat="server" ID="password" TextMode="Password" CssClass="form-control" placeholder="Password.." />
                                         <asp:RequiredFieldValidator runat="server" ControlToValidate="password" CssClass="text-danger" ErrorMessage="The password field is required." />

Open in new window

$("#btnResetPassword").click(function(e) {
    console.log("We have clicked the reset button");


function disableAllValidators() {
    console.log(document.getElementById("<%=userName.ClientID %>"));
    document.getElementById("<%=userName.ClientID %>").enabled = false;

Open in new window

Can you please suggest, how I can disable the validators, as soon as the Reset Password button is clicked?
Wayne AthertonProduct Analyst Financial Messaging LondonAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Randy DownsOWNERCommented:
Try this

Something you may be able to adapt to your needs (this will disable all the validators via client script):

if (typeof Page_Validators != 'undefined') {
        for (i = 0; i <= Page_Validators.length; i++) {
            var vldGrp = null;
            if (Page_Validators[i] != null) {
                vldGrp = Page_Validators[i].validationGroup;
                ValidatorEnable(Page_Validators[i], false);

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.