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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:19:21+00:00 2026-06-17T15:19:21+00:00

I have a JS Method as follows: ( I don’t know if it’s 100%

  • 0

I have a JS Method as follows: ( I don’t know if it’s 100% correct)

<script Type="Text/Javascript">

if (confirm("Are you SUre ?")) {
  return true;
} else {
  return false;
}

</script>

And have some doubts:

First: I have a folder called JS and i’m planing to put it there, is this correct?

Second: I will use this on an Edit page, so when the customer clickon the button edit I’d like this confirmation with some message like "Are you Sure? and the buttons Yes/No
If the customer clicks on the Yes then i’ll keep with my edit on database.
So how do I do that ? How I call this method at the moment that the customer click on the ImageButton ?

One more thing: How Do I get the return of this method and work with it on my aspx.cs using C#?

I tried the code below, but didn’t work =\ it shows me the popUp but even when I click cancel it goes to the OnClick Method

<asp:ImageButton ID="Btn_Alterar" runat="server" ImageUrl="~/Imgs/btAlterar.jpg" OnClick="Btn_Alterar_Click" OnClientClick="confirm()" />
  • 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-17T15:19:22+00:00Added an answer on June 17, 2026 at 3:19 pm

    This should work. It will pop up the question and if they say yes then will process the server side code (as an example).

    JS:

    <script language="javascript">
    <!--
    function doConfirm() {
        if (confirm("Are you SUre ?")) {
          //Person has said Yes, do your thing. Next line will allow the server side code to be processed
          return true
        } else {
          //User said No, do nothing and leave next line so the function call exits. 
          return false
        }
    }
    -->
    </script>
    

    ASP.NET Control:

    <asp:ImageButton id="bMyButton" runat="server" onClientClick="doConfirm()" OnClick="DoServerSideCode" />
    

    .CS

    protected void DoServerSideCode(object sender, EventArgs e)
    {
        //This will be called if JS is disabled OR the user clicks Yes. If the user clicks No then this won't be called. You can do DB logix here.
    }
    

    Edit: (with thanks to @justnS)

    Another implementation would be:

    ASP.NET Control:

    <asp:ImageButton id="bMyButton" runat="server" onClientClick="return confirm('Are you sure?')" OnClick="DoServerSideCode" />
    

    The above is exactly the same as the previous implementation but takes less code and is done inline.

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

Sidebar

Related Questions

i have a method as follows. test(Object obj){ } now within this method i
I have a template method as follows:- template<typename T, int length> void ProcessArray(T array[length])
I have a __new__ method as follows: class MyClass(object): def __new__(cls, *args): new_args =
I have a method defined in IDL as follows : interface IMyFunc : IDispatch
I have a method in a class as follows... class foo{ int bar::randomNum10to50(){ srand
So I have a class with a method as follows: public class SomeClass {
The scenario I am using LINQ is as follows: I have a method that
I have a class with a static method modifying a static variable as follows,
I have an app which pretty much follows the method described here . The
I have a method that checks some assumptions and either follows the happy path,

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.