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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:58:46+00:00 2026-06-14T09:58:46+00:00

Below is the code of a simple page with a button. <%@ Page Title=

  • 0

Below is the code of a simple page with a button.

<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true"
CodeBehind="AdminPage.aspx.cs" Inherits="School.AdminPage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<script type="text/javascript">
    function calling() {
        var user = "all";
        alert(user)
    }
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<button runat="server" onclick="calling()">
    Mybutton</button>
</asp:Content>

On click of button, alert appear and when i click ok on that alert dialog box…page gets reloaded….why it get reloaded and how to stop this.

  • 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-14T09:58:47+00:00Added an answer on June 14, 2026 at 9:58 am

    The “default event” is occurring.

    To disable it, use return before you function call as follows:

    <button runat="server" onclick="return calling()">
    

    And in the function:

    <script type="text/javascript">
       function calling() {
           var user = "all";
           alert(user);
           return false;
       }
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Below is the code of my simple page's submit button click. I am submitting
The simple code block below can be served up in a static HTML page
Below is my code for a simple form in the create_session.php page. I am
The below code is very simple. I have a jQuery autocomplete bound to an
I have a simple code below: import java.util.ArrayList; public class BoidList extends ArrayList {
I am testing this simple code below and it works... $(document).ready( function() { $('.show-modal').click(
I am using the below code snippet to FTP simple text files from a
The code below is for a simple newsletter signup widget. I'm sure there's a
I have written a very simple WCF service, that worked fine (code below), then
I've got a simple question but it has got me confounded. The code below

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.