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 2966
> 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: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
| |