Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6172705
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:26:22+00:00 2026-05-23T23:26:22+00:00

I have an aspx page where I have used jquery validator in a different

  • 0

I have an aspx page where I have used jquery validator in a different .js file. my code for this file is

function checkRequiredInputs(){

$("#frmSaleSubmissionInfo").validate({  
    rules:{
        txtFName:{required: true},
        txtLName:{required: true},
        txtAddress:{required: true},
        txtPhone:{required: true}
    },
    messages:{
        txtFName:"Enter Name",
        txtLName:"Enter Name",
        txtAddress:"Enter Address",
        txtPhone:"Enter Phone Number"
    }
});

$("#txtPhone").keydown(function(event) {
    // Allow only backspace,delete,comma(,),left arrow,right arraow and Tab
    if ( event.keyCode == 46 || event.keyCode == 8 || event.keyCode == 188 
        || event.keyCode == 37 || event.keyCode == 39 || event.keyCode == 9){
        // let it happen, don't do anything
    }
    else {
        // Ensure that it is a number and stop the keypress
        if ((event.keyCode < 48 || event.keyCode > 57) && (event.keyCode <96 ||event.keyCode > 105) ) {
            event.preventDefault(); 
        }   
    }
});

} 

and the validation code is implemented in the aspx

<script type="text/javascript">   
    $(document).ready(function(){
        checkRequiredInputs();
}); 

 </script>

I have a close button and it’s like

<asp:ImageButton ID="btnClose" runat="server" ImageUrl="~/ButtonImages/Button_Close_Normal.png"
                    Height="16px" onclick="btnClose_Click" />

and its click event is
protected void btnClose_Click(object sender, ImageClickEventArgs e)
{
Response.Redirect(“anotherPage.aspx”, false);
}

Now my problem is that whenever I click close button, if the validation fails, i.e. if any of the required field remains empty, its not letting to the go that another page. But if validation does not occur, then, The close button takes me to that another page. My obejct is to make that close button work regardless of any client side validation? What will I do? please help me, thank you in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T23:26:23+00:00Added an answer on May 23, 2026 at 11:26 pm

    If all you’re doing when you click btnClose is: Response.Redirect("anotherPage.aspx", false); then why bother with a server side control at all? I would replace btnClose with:

    <a href="/anotherPage.aspx"><img src="~/ButtonImages/Button_Close_Normal.png" /></a>
    

    This will work regardless

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ASP .NET page where I use jQuery. I used this function
I have used jquery datepicker in my .aspx page. The control is working fine.
I have multiple custom controls used on a ASPX (and C#) page registered from
I have an ASPX page and on this page I have a control that
I have created a web custom control and used within an aspx page. I
I have a website that has 2 files as follows: page.aspx page.aspx.cs It used
I have no issues when doing using JQuery in a aspx page without a
I have used a tutorial http://www.devcurry.com/2010/06/load-page-dynamically-inside-jquery-ui.html to dynammically load an aspx page into a
I need to load aspx page into jQuery UI's modal dialog window. I used
I have some code that is used to replace certain page output with other

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.