Click here to Skip to main content
16,019,514 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
I have a ASP.net Project with C#. There I want to show a message box with yes no button under without button post. if i click yes the one happen done if i click no then another happen done. Pleas help me with simplest way.
Posted

use Javascript for That on button OnClientCLick:

C#
if(!confirm('Are you Sure to  do this Action?'))
 {
     return false;
 }


hope this will help you.
 
Share this answer
 
v2
message box with yes no button
For this, you would need VBScript confirm instead of Javascript. Javascript gives, Ok & Cancel as options whereas VBScript will give you Yes & No.
Please find the link below that has all the options and will help you out: Alerts, Confirms and Prompts [^]

OR

you can try jQuery modal-dialog or UI-confirm-dialog and configure it for yes-no option.
Refer:
How to Create a jQuery Confirm Dialog Replacement[^]
ASP.NET jQuery UI confirm dialog [^]
ASP.NET JQuery Confirm Dialog[^]

OR

you can use Ajax ModalPopupExtender for it.
Refer: ASP.NET confirmation box with yes/no button options using modalpopup[^]
 
Share this answer
 
v2
Comments
DamithSL 1-Jul-12 5:43am    
my 5!
SoMad 1-Jul-12 22:32pm    
Nice, +5. I would go with one of the jQuery solutions.

Soren Madsen

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900