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

  • SEARCH
  • Home
  • 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 6195809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:32:00+00:00 2026-05-24T03:32:00+00:00

I have an asp.net app with an asp:button that causes a postback, this means

  • 0

I have an asp.net app with an asp:button that causes a postback, this means that the html for the input has an onclick attribute that is auto generated, I need to add an event via jQuery to the onclick attribute that fires before the auto generated postback is fired.

Below is an example of the html generated, i need to make sure that my event added by jQuery fires before the WebForm_DoPostBackWithOptions() function.

<input id="ctl00_MainContent_Save" type="submit" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$MainContent$Save", "", true, "", "", false, false))" value="" name="ctl00$MainContent$Save">

for more clarity, I know I can add an event via jQuery like this:

$('#ctl00_MainContent_Save').click(function() {
    somfunction();
});

but i want my event to fire before the WebForm_DoPostBackWithOptions

  • 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-24T03:32:00+00:00Added an answer on May 24, 2026 at 3:32 am

    You can probably try mousedown event which will be fired before the click event is triggered.

    $('#ctl00_MainContent_Save').mousedown(function() {
        somfunction();
    });
    

    or try the below code

    $(document).ready(function(){
    
      $('#ctl00_MainContent_Save')
      .attr("onclick", null)
      .removeAttr("onclick")
      .click(function() {
            somfunction();
            WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions($(this).attr("name"), "", true, "", "", false, false));
        });
    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a asp.net app that I want to disable the buttons as soon
Good day, I have a ASP.net MVC app that needs to upload files to
I have an ASP.NET 4 web app. I am using a Master Page Site.Master.
I'm converting an existing ASP.NET app to MVC2, and I have an existing method
I have an asp.net page (C# codebehind), and in page_load there are various linq
On my opportunity product form i have added a IFrame to display a asp.net
I have a website that I have registered as a facebook app - I
I have set of components that i wish to let the users download from
I remember I could easily do this in PHP but can't seem to find
i want to automate a user going into the "Find Records" / multi search

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.