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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:53:17+00:00 2026-05-29T05:53:17+00:00

i have an asp server button that when clicked should preform some server side

  • 0

i have an asp server button that when clicked should preform some server side code run a javascript method at the same time the button looks like this:

<asp:Button ID="Button3" runat="server" onclick="Button3_Click" OnClientClick="timing()" Text="Check Spam" />

when clicking the application for the first time everything works fine both methods execute but if the button is clicked again only the javascript method executes
i searched and found some solutions but none of them worked for me, any help will be appreciated
thanks a lot in advance

the javascript methods used are

    var popupStatus = 0;
function loadPopup() {
    //loads popup only if it is disabled
    if (popupStatus == 0) {
        var test = document.getElementById('ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolder2_hidden1').value + "<div>success <input id=\"Button1\" type=\"button\" value=\"button\" onclick=\"disablePopup()\" /> </div>";
        $("#popupContact").html(test);
        $("#backgroundPopup").css({
            "opacity": "0.7"
        });
        $("#backgroundPopup").fadeIn("slow");
        $("#popupContact").fadeIn("slow");
        popupStatus = 1;
    }
}

function disablePopup() {
    //disables popup only if it is enabled
    if (popupStatus == 1) {
        $("#backgroundPopup").fadeOut("slow");
        $("#popupContact").fadeOut("slow");
        popupStatus = 0;      
    }
}

function centerPopup() {
    //request data for centering
    // var windowWidth = document.documentElement.clientWidth;
    var windowHeight = document.documentElement.clientHeight;
    var windowWidth = document.documentElement.clientWidth;
    var popupHeight = $("#popupContact").height();
    var popupWidth = $("#popupContact").width();
    //centering
    $("#popupContact").css({
        "position": "absolute",
        "top": windowHeight.top - popupHeight / 2,
        "left": windowWidth / 2 - popupWidth / 2
    });
    //only need force for IE6

    $("#backgroundPopup").css({
        "height": windowHeight
    });

}

function check() {
    centerPopup(); 
    loadPopup();
}

function timing() {
    setTimeout('check()', 10000);
}

function timing waits 10 seconds then calls check wich calls a two methods to load and center a popup

  • 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-29T05:53:18+00:00Added an answer on May 29, 2026 at 5:53 am

    settimeout call returns immediately. And the button click sends the call to server, if the server call returns faster than 10 secs, your javascript call gets cancelled. The whole sequence doesn’t seem to be reliable.

    How about submitting asp.net form the javascript function itself.

    [http://www.codeproject.com/Articles/4368/Post-an-ASP-NET-form-with-JavaScript][1]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some simple javascript that I'd like to run when a button is
I have an ASP.Net page that has a button that when clicked I would
I have an asp.net server control (with the asp: in its definition). The button
I have an ASP.NET server that I do not have direct access to. How
I have an ASP.NET MVC server app and client code which uses jquery. I'd
I have an image button that when clicked the first time it just seems
I have this label that i want to fadeOut after button event clicked. I
Within an asp.net webform I have some jquery that controls the positioning of elements
I have this layout: <div runat=server OnClick=ChangeText() id=button>Ok</div> <asp:UpdatePanel id=updater runat=server> <ContentTemplate> <div id=text>Hello</div>
I have a asp gridview with button field column on that button click I

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.