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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T16:30:47+00:00 2026-06-10T16:30:47+00:00

I need to run a specific javascript function only when the page is submitted

  • 0

I need to run a specific javascript function only when the page is submitted using ajax.
I’ve tried the following:

ScriptManager.RegisterOnSubmitStatement(Page, Page.GetType(), 
    "scriptName", "MyFunction();");

But it seems to run during normal post-backs as well. I’ve also tried replacing the Page object with the UpdatePanel control but without any difference.

Is it perhaps possible inside the javascript function MyFunction() to detect if it is an ajax or normal submit?

  • 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-10T16:30:49+00:00Added an answer on June 10, 2026 at 4:30 pm

    This code solved the problem. Thanks to @user1341446 for pointing me in the right direction.

    Register the javascript function on submit:

    ScriptManager.RegisterOnSubmitStatement(Page, Page.GetType(), 
        "scriptName", "MyFunction();");
    

    Inside the function detect if ajax submit:

    function MyFunction()
    {
      var isAjaxSubmit = false;
      if (typeof (Sys) != "undefined")
        isAjaxSubmit = 
           Sys.WebForms.PageRequestManager.getInstance()._postBackSettings.async;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using JSF framework in my application. I need to run a specific
I want to run a sql query on a specific schedule (weekly) and need
I need some assistance in creating a shell script to run a specific command
I need to run a specific command for a bunch of dates. To that
I need to run a specific mysql query upon wget, which is running in
I want to run specific javascript on certain scenarios. I would like not to
I'm using Quartz with Spring to run a specific task at midnight on the
Possible Duplicate: Determine if Equals() is an override? I need to run specific pieces
I need to run some tasks on the specific celeryd instance. So I configured
When javascript is run in the browser there is no need to try and

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.