Hi People,
Wondering how we display confirmation boxes to the user in order to confirm
his action, before we can proceed. How do we get back the value from the
user's action, i.e. if he selects yes, or he selected no, in to our code in
c#.net, so we can take the appropriate action. I'm not very clear on
javascript interaction with asp.net.
Hope you guys can help,
Thanks,
I.A 4 2968
> Wondering how we display confirmation boxes to the user in order to confirm his action, before we can proceed. How do we get back the value from the user's action, i.e. if he selects yes, or he selected no, in to our code in c#.net, so we can take the appropriate action. I'm not very clear on javascript interaction with asp.net.
Generally this is done like so:
<asp:button id="..." runat="server" text="..." onclick="return confirm('Are
you sure you want to do this?');" />
Where if false is returned from the onclick handler, the postback will not
occur. If you want to know if they select no, you'll need to wrap the confirm
in something that will return the value, something like:
<input type="hidden" runat="server" id="confirmResult" />
<asp:button ... onclick="document.getElementById('confirmResult'). value =
confirm('Are you sure you want to do this?);" />
Then check for confirm result in the click handler for the button.
Hth, Rya
> Wondering how we display confirmation boxes to the user in order to confirm his action, before we can proceed. How do we get back the value from the user's action, i.e. if he selects yes, or he selected no, in to our code in c#.net, so we can take the appropriate action. I'm not very clear on javascript interaction with asp.net.
Generally this is done like so:
<asp:button id="..." runat="server" text="..." onclick="return confirm('Are
you sure you want to do this?');" />
Where if false is returned from the onclick handler, the postback will not
occur. If you want to know if they select no, you'll need to wrap the confirm
in something that will return the value, something like:
<input type="hidden" runat="server" id="confirmResult" />
<asp:button ... onclick="document.getElementById('confirmResult'). value =
confirm('Are you sure you want to do this?);" />
Then check for confirm result in the click handler for the button.
Hth, Rya
couple notes:
1) onclick for a asp:button is the server click, so you need to use the code
behind and add an attribute to do the client clcik,
2) some versions of IE 6.0 have bug where "return false", does not cancel
the postback. you need to cancel in the event
if (document.all && window.event ) event.returnValue = false; return
false;
-- bruce (sqlwork.com)
"Ryan Trudelle-Schwarz" <ne**@mamanze.com> wrote in message
news:45**************************@news.microsoft.c om...
| > Wondering how we display confirmation boxes to the user in order to
| > confirm his action, before we can proceed. How do we get back the
| > value from the user's action, i.e. if he selects yes, or he selected
| > no, in to our code in c#.net, so we can take the appropriate action.
| > I'm not very clear on javascript interaction with asp.net.
|
| Generally this is done like so:
|
| <asp:button id="..." runat="server" text="..." onclick="return
confirm('Are
| you sure you want to do this?');" />
|
| Where if false is returned from the onclick handler, the postback will not
| occur. If you want to know if they select no, you'll need to wrap the
confirm
| in something that will return the value, something like:
|
| <input type="hidden" runat="server" id="confirmResult" />
| <asp:button ... onclick="document.getElementById('confirmResult'). value =
| confirm('Are you sure you want to do this?);" />
|
| Then check for confirm result in the click handler for the button.
|
| Hth, Ryan
|
|
couple notes:
1) onclick for a asp:button is the server click, so you need to use the code
behind and add an attribute to do the client clcik,
2) some versions of IE 6.0 have bug where "return false", does not cancel
the postback. you need to cancel in the event
if (document.all && window.event ) event.returnValue = false; return
false;
-- bruce (sqlwork.com)
"Ryan Trudelle-Schwarz" <ne**@mamanze.com> wrote in message
news:45**************************@news.microsoft.c om...
| > Wondering how we display confirmation boxes to the user in order to
| > confirm his action, before we can proceed. How do we get back the
| > value from the user's action, i.e. if he selects yes, or he selected
| > no, in to our code in c#.net, so we can take the appropriate action.
| > I'm not very clear on javascript interaction with asp.net.
|
| Generally this is done like so:
|
| <asp:button id="..." runat="server" text="..." onclick="return
confirm('Are
| you sure you want to do this?');" />
|
| Where if false is returned from the onclick handler, the postback will not
| occur. If you want to know if they select no, you'll need to wrap the
confirm
| in something that will return the value, something like:
|
| <input type="hidden" runat="server" id="confirmResult" />
| <asp:button ... onclick="document.getElementById('confirmResult'). value =
| confirm('Are you sure you want to do this?);" />
|
| Then check for confirm result in the click handler for the button.
|
| Hth, Ryan
|
| This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: frasfan |
last post by:
Hi,
I am having a problem with the validator controls in VB.net
conflicting with the javascript I am using to confirm whether or not
the user wants to submit the page. Here is the situation: I...
|
by: fig000 |
last post by:
Hi,
I'm relatively new to Javascript so please bear with me on what
might sound like silly questions.
This is what I want to do:
I'm working in classic asp (I have to for this project). I...
|
by: dmiller23462 |
last post by:
Hi guys....I have absolutely NO IDEA what I'm doing with Javascript
but my end result is I need two text boxes to stay hidden until a
particular option is selected....I've cobbled together the...
|
by: Brent_White_99 |
last post by:
I copied the code from another HTML script that someone before me had
written. I have no Javascript experience (I'm a VB Programmer/DBA) at
all.
The code below works to a certain extent. There...
|
by: Irfan Akram |
last post by:
Hi People,
I have got a simple question to ask. I am trying to build dynamic controls
in asp.net. I have managed to build them successfully. I have also managed to
add the event handlers to all...
|
by: Irfan Akram |
last post by:
Hi People,
Wondering how we display confirmation boxes to the user in order to confirm
his action, before we can proceed. How do we get back the value from the
user's action, i.e. if he selects...
|
by: bienwell |
last post by:
Hi all,
I still have a problem when using Confirmation box in ASP.NET program. I
need to get the value return of YES or NO from confirmation box in Sub
function of VB program to do some tasks....
|
by: den 2005 |
last post by:
Hi everybody,
Question 1: How do you set the values from server-side to a client-side
control or how do you execute a javascript function without a button click
event?
Question 2: How do you...
|
by: bay_dar |
last post by:
Hi, I have an internal ASP.NET application that I'm are using to send
e-mails out based on a single milepost or milepost range entered.
I'm trying to do two things when a user clicks on the...
|
by: =?Utf-8?B?c3Jpbml2YXM=?= |
last post by:
Hi,
I'm having an ASP.net page with a dropdown list box named ddlStatus, a
button and editable gridview.
I wrote a small javascript function "OnSave()" and called it on the event...
|
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,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |