Click here to Skip to main content
15,884,628 members
Please Sign up or sign in to vote.
2.00/5 (2 votes)
See more:
Condition message in web programing
Hi
Before delete a record , it must be send a message for user . if user press OK record be deleted . how can we write this message in web programing?
In windows programming it is :
C#
if (MessageBox.Show("Are you sure want to delete this item ?", "Warning!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
            {
                MessageBox.Show("…");
            }

Thanks very much
Posted

Try some thing like this:

JavaScript
"javascript:if(confirm('Are you sure you want to delete this item?') == false) return false;"


It can be shortened a bit by simply returning the confirm, but thew above is clearer.
 
Share this answer
 
Comments
Uday P.Singh 6-Feb-12 12:45pm    
5!
thatraja 6-Feb-12 13:14pm    
Simple, 5!
Sergey Alexandrovich Kryukov 6-Feb-12 14:51pm    
Simple and clear, my 5.
--SA
You can use jQuery UI dialog[^] widget.
 
Share this answer
 
Comments
thatraja 6-Feb-12 13:17pm    
I prefer this one, 5!
Wonde Tadesse 10-Feb-12 15:30pm    
Thanks
R. Giskard Reventlov 6-Feb-12 13:20pm    
Whilst I like the simplicity of my solution above, this is pretty cool: gets my 5.
Wonde Tadesse 10-Feb-12 15:30pm    
Thanks
Sergey Alexandrovich Kryukov 6-Feb-12 14:51pm    
Right, this is a pretty robust thing, my 5. :-)
--SA
 
Share this answer
 
Comments
thatraja 6-Feb-12 13:17pm    
Both good, 5!
Sergey Alexandrovich Kryukov 6-Feb-12 14:51pm    
Useful reading, my 5.
--SA

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