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 9190627
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:30:23+00:00 2026-06-17T20:30:23+00:00

For some reason I’m using HTML controls with runat=server . One of these controls

  • 0

For some reason I’m using HTML controls with runat="server". One of these controls is a button. I have client-side validation function. I wan’t to fire server-side action after successful client-side validation.

HTML:

<button type="button" id="webSubmit" 
runat="server" 
onclick="return $('#form1').valid();">Submit</button>

Server side:

protected void webSubmit_ServerClick(object sender, EventArgs e)
{
   //foo
}

When I click the button it validates the form but does not postback even if validation returns true.

It’s generated by ASP.net:

<button onclick="return $('#form1').valid(); __doPostBack('webSubmit','')" 
id="webSubmit" type="button">Submit</button>
  • 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-06-17T20:30:24+00:00Added an answer on June 17, 2026 at 8:30 pm

    I changed onclick code to this:

    onclick="$('#form1').valid() && "
    

    ASP.net generated code is:

    <button onclick="$('#form1').valid() &&  __doPostBack('webSubmit','')" 
    id="webSubmit" type="button">Submit</button>
    

    It’s equal to:

    if ($('#form1').valid()){
    __doPostBack('webSubmit','')
    }
    

    I got the idea from: Can I omit the else in an inline javascript if statement?

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

Sidebar

Related Questions

For some reason, I have to change the default value of one parameter 'param'
For some reason the postback event keeps firing for my button. If I place
For some reason this isn't working, am I missing something obvious? RewriteRule ^(.*)infopopup.html$ /acatalog/infopopup.html
For some reason beyond me my html page is not finding my stylesheet. I'm
For some reason my recvfrom() function for sockets is not blocking on my server
For some reason my app is using more and more memory as it runs,
For some reason we are getting a Server response was not a 200 OK
For some reason I have to delete phonegap-1.4.1 and use cordova-1.5.0, For this what
For some reason, when using this code the file it outputs is just called
For some reason, I have a sorted php array: $arr_questions = Array [6] 0

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.