Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > display confirm message box for action

Reply
Thread Tools

display confirm message box for action

 
 
Grey
Guest
Posts: n/a
 
      09-06-2004
how to design confirm message box, like Javascript Confirm box, in ASP.NET??
if the user click "YES" in the confirm box, i need to do something, else do
other things. Do I need to have javascript confirm box or ASP.NET has such
feature??


Million thanks.


 
Reply With Quote
 
 
 
 
Mark Rae
Guest
Posts: n/a
 
      09-06-2004
"Grey" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...

> how to design confirm message box, like Javascript Confirm box, in
> ASP.NET??
> if the user click "YES" in the confirm box, i need to do something, else
> do
> other things. Do I need to have javascript confirm box or ASP.NET has such
> feature??


For client-side user interaction, use JavaScript.


 
Reply With Quote
 
 
 
 
=?Utf-8?B?SGFuZGk=?=
Guest
Posts: n/a
 
      09-06-2004
for example:
create a button: button1
Page_Load():
this.Button1.Attributes.Add("onclick","javascript: if(confirm('No to
cancel?')== false) return false;");

if "Cancel" button pressed, this page will not post back.


"Grey" wrote:

> how to design confirm message box, like Javascript Confirm box, in ASP.NET??
> if the user click "YES" in the confirm box, i need to do something, else do
> other things. Do I need to have javascript confirm box or ASP.NET has such
> feature??
>
>
> Million thanks.
>
>
>

 
Reply With Quote
 
Greg Burns
Guest
Posts: n/a
 
      09-06-2004
Just to add to this.

You can ONLY cancel the post back with javascript like this, you cannot
branch and "do other things".

Greg

"Handi" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> for example:
> create a button: button1
> Page_Load():
> this.Button1.Attributes.Add("onclick","javascript: if(confirm('No to
> cancel?')== false) return false;");
>
> if "Cancel" button pressed, this page will not post back.
>
>
> "Grey" wrote:
>
>> how to design confirm message box, like Javascript Confirm box, in
>> ASP.NET??
>> if the user click "YES" in the confirm box, i need to do something, else
>> do
>> other things. Do I need to have javascript confirm box or ASP.NET has
>> such
>> feature??
>>
>>
>> Million thanks.
>>
>>
>>



 
Reply With Quote
 
Hans Kesting
Guest
Posts: n/a
 
      09-06-2004

"Handi" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
> for example:
> create a button: button1
> Page_Load():
> this.Button1.Attributes.Add("onclick","javascript: if(confirm('No to
> cancel?')== false) return false;");
>
> if "Cancel" button pressed, this page will not post back.
>
>


Just a note: don't change the javascript to the seemingly identical but shorter
return confirm('No to cancel?')
because .Net can add it's own javascript to that onclick handler. This shorter
version would prevent the execution of that code! This is also why you *need*
the closing ";" to separate your code from the additional code.

By the way, you don't need to specify "javascript:" for an onclick handler.

Hans Kesting


> "Grey" wrote:
>
>> how to design confirm message box, like Javascript Confirm box, in ASP.NET??
>> if the user click "YES" in the confirm box, i need to do something, else do
>> other things. Do I need to have javascript confirm box or ASP.NET has such
>> feature??
>>
>>
>> Million thanks.
>>
>>
>>



 
Reply With Quote
 
Greg Burns
Guest
Posts: n/a
 
      09-06-2004
I've never seen that recomendation before. Is it related to the classic
"validator ate my onclick event" problem?

one example of problem:
http://tinyurl.com/6bkvw

Greg


> Just a note: don't change the javascript to the seemingly identical but
> shorter
> return confirm('No to cancel?')
> because .Net can add it's own javascript to that onclick handler. This
> shorter
> version would prevent the execution of that code! This is also why you
> *need*
> the closing ";" to separate your code from the additional code.
>
> By the way, you don't need to specify "javascript:" for an onclick
> handler.
>
> Hans Kesting



 
Reply With Quote
 
=?Utf-8?B?TGVl?=
Guest
Posts: n/a
 
      09-07-2004
Is it possible to have button text as Yes/No instead of OK/Cancel ??

"Greg Burns" wrote:

> I've never seen that recomendation before. Is it related to the classic
> "validator ate my onclick event" problem?
>
> one example of problem:
> http://tinyurl.com/6bkvw
>
> Greg
>
>
> > Just a note: don't change the javascript to the seemingly identical but
> > shorter
> > return confirm('No to cancel?')
> > because .Net can add it's own javascript to that onclick handler. This
> > shorter
> > version would prevent the execution of that code! This is also why you
> > *need*
> > the closing ";" to separate your code from the additional code.
> >
> > By the way, you don't need to specify "javascript:" for an onclick
> > handler.
> >
> > Hans Kesting

>
>
>

 
Reply With Quote
 
Greg Burns
Guest
Posts: n/a
 
      09-07-2004
AFAIK, not with a javascript confirm. Maybe using vbscript msgbox...?

Greg

"Lee" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Is it possible to have button text as Yes/No instead of OK/Cancel ??
>
> "Greg Burns" wrote:
>
>> I've never seen that recomendation before. Is it related to the classic
>> "validator ate my onclick event" problem?
>>
>> one example of problem:
>> http://tinyurl.com/6bkvw
>>
>> Greg
>>
>>
>> > Just a note: don't change the javascript to the seemingly identical but
>> > shorter
>> > return confirm('No to cancel?')
>> > because .Net can add it's own javascript to that onclick handler. This
>> > shorter
>> > version would prevent the execution of that code! This is also why you
>> > *need*
>> > the closing ";" to separate your code from the additional code.
>> >
>> > By the way, you don't need to specify "javascript:" for an onclick
>> > handler.
>> >
>> > Hans Kesting

>>
>>
>>



 
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
dropdown confirm message box hamsinii ASP .Net 0 07-06-2006 12:12 PM
Finally found how to display confirm dialog box Tony Baker ASP .Net 0 12-17-2003 11:59 AM
How to popup confirm message box in asp.net Padam Jain ASP General 2 07-14-2003 10:45 AM
How to popup confirm message box in asp.net Padam Jain ASP .Net Web Controls 1 07-14-2003 08:19 AM
How to popup confirm message box in asp.net Padam Jain ASP .Net 1 07-14-2003 08:19 AM



Advertisments