473,387 Members | 3,787 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Client Side Confirm

I want to use a confirm ("Are you sure?") for deletes but can't seem to get
it to work without using built in commands (delete, insert, etc) If I use a
button click event the process continues to execute just as if I hit OK when
the cancel button is clicked.
Why does this happen and how do I implement a confirmation for events?

<asp:Button ID="Button1" runat="server" onclick="Button1_Click"
onclientclick="confirm('Are you sure?')" Text="Button" />

protected void Button1_Click(object sender, EventArgs e)

{

Button1.Text = "OK";

}

No matter which confirm button I click it executes the Button1_Click
Aug 4 '08 #1
2 1069
"randy.buchholz" <ra************@dads.state.tx.uswrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
onclientclick="confirm('Are you sure?')" Text="Button" />
OnClientClick=" return confirm('Are you sure?')" Text="Button" />
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Aug 4 '08 #2
Awesome - thanks.

"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:uH**************@TK2MSFTNGP02.phx.gbl...
"randy.buchholz" <ra************@dads.state.tx.uswrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>onclientclick="confirm('Are you sure?')" Text="Button" />

OnClientClick=" return confirm('Are you sure?')" Text="Button" />
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Aug 4 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: RSB | last post by:
Hi Every one, Having tuff time to make this work .. i want to have a button and on my form say Delete button. So once i click on it i want to confirm "Are you sure?" on the Client Side and if...
5
by: KathyB | last post by:
If someone could just explain this to me...I just don't get it! I have an aspx page where I retrieve several session variables and use xmlDocument to transform xml file with xsl file into an...
1
by: Stephen | last post by:
Hey Everyone, I have a problem with a web application due to the use of both client-side and server side script on the on-click event of a button. The client side script runs first as expected...
1
by: Stephen | last post by:
Hey All, I have a problem with a web application due to the use of both client-side and server side script on the on-click event of a button. The client side script runs first as expected however...
2
by: giant food | last post by:
Hi, I'm writing an asp app. I have a text box with a validator and a submit button. Here is code from my .aspx file.... <asp:TextBox ID="txName" TextMode="SingleLine" Runat="server" />...
3
by: Ahmad Jalil Qarshi | last post by:
Hi, I am developing a website in ASP.NET. I want to have a client side code to confirm the deletion of some information from backend database. I want to use a Message Box have two buttons "Yes"...
7
by: Alex Maghen | last post by:
I have a DataGrid control with a LinkButton command column that deletes the row. What I want to do is set it up so that there's a client-side Confirm alert BEFORE the actual Delete command gets...
2
by: NH | last post by:
I have a gridview with a delete button as follows... <ItemTemplate> <asp:ImageButton id="deleteAttachment" OnClientClick='return confirm("Are you sure you want to delete this Attachment?");'...
5
by: sweetpotatop | last post by:
Hi, I have a page written in C# asp.net, which allow users to select and delete records. Once user selects the record to be deleted, I will confirm with the user, something like "Are you sure...
1
by: sweetpotatop | last post by:
Hi, I have an asp.net project written in C# It has a list of records for users to delete and select. When user click the "Delete" button, I would like to ask the user to confirm before I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.