Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How to handle Cancel button in Confirm() method?

Reply
Thread Tools

How to handle Cancel button in Confirm() method?

 
 
lakshmikandhan@gmail.com
Guest
Posts: n/a
 
      04-04-2006
Hi All,

Can anyone tell how to handle the Cancel button in the
JavaScript Confirm() method?If we press cancel, I have to perform
certain action in the Server side? Plz help me!!

Thanx,
Jacob.

 
Reply With Quote
 
 
 
 
lakshmikandhan@gmail.com
Guest
Posts: n/a
 
      04-04-2006
Hi Eliyahu,

Thanx for ur response.Can u explain the above concept by an
simple example??? Plz give me some code samples!!

 
Reply With Quote
 
 
 
 
Eliyahu Goldin
Guest
Posts: n/a
 
      04-04-2006
Jacob,

Cancel button click causes the confirm dialog to close with return value
false. All this is taking place on client-side. You will need to communicate
an info to the server side. Most standard way of doing this is using hidden
input elements. You can cause the page to postback from JavaScript by
calling the form's submit() method.

Eliyahu

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...
> Hi All,
>
> Can anyone tell how to handle the Cancel button in the
> JavaScript Confirm() method?If we press cancel, I have to perform
> certain action in the Server side? Plz help me!!
>
> Thanx,
> Jacob.
>



 
Reply With Quote
 
Eliyahu Goldin
Guest
Posts: n/a
 
      04-04-2006
on client:
if(!confirm("...")){
myForm..value="CANCELED";
myForm.submit();
}

in .aspx file:
<input type=hidden id=inhMessage runat=server>

in the code-behind (c#):
in the Page_Load event:
if (IsPostBack())
{
if (this.inhMessage.Value == CANCELED")
{
// do something
}
}

Eliyahu


<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> Hi Eliyahu,
>
> Thanx for ur response.Can u explain the above concept by an
> simple example??? Plz give me some code samples!!
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
pop-up with yes-no button instead of confirm() with ok-cancel button Indu Javascript 9 11-20-2005 02:46 PM
Possible to handle web requests without an ASPX page? i.e. have DLL handle request. jdlwright@shaw.ca ASP .Net 2 05-31-2005 05:42 PM
HELP CANCEL CANCEL CANCEL Carmen Rosario Computer Support 7 04-06-2005 11:04 PM
how to handle command line output(not terminal handle) Leon Python 2 11-04-2004 05:16 AM
File Handle Reading Blues: Rereading a File Handle for Input Dietrich Perl 1 07-22-2004 10:02 AM



Advertisments