Confirmation Box in C# wpf [duplicate]

Instead of using WinForm MessageBox, use the MessageBox provided by WPF and later use MessageBoxResult instead of DialogResult in WPF. like: MessageBoxResult messageBoxResult = System.Windows.MessageBox.Show(“Are you sure?”, “Delete Confirmation”, System.Windows.MessageBoxButton.YesNo); if (messageBoxResult == MessageBoxResult.Yes) //………..

Confirm deletion using Bootstrap 3 modal box

You need the modal in your HTML. When the delete button is clicked it popup the modal. It’s also important to prevent the click of that button from submitting the form. When the confirmation is clicked the form will submit. $(‘button[name=”remove_levels”]’).on(‘click’, function(e) { var $form = $(this).closest(‘form’); e.preventDefault(); $(‘#confirm’).modal({ backdrop: ‘static’, keyboard: false }) .on(‘click’, … Read more

JavaScript Form Submit – Confirm or Cancel Submission Dialog Box

A simple inline JavaScript confirm would suffice: <form onsubmit=”return confirm(‘Do you really want to submit the form?’);”> No need for an external function unless you are doing validation, which you can do something like this: <script> function validate(form) { // validation code here … if(!valid) { alert(‘Please correct the errors in the form!’); return false; … Read more

How to show the “Are you sure you want to navigate away from this page?” when changes committed?

Update (2017) Modern browsers now consider displaying a custom message to be a security hazard and it has therefore been removed from all of them. Browsers now only display generic messages. Since we no longer have to worry about setting the message, it is as simple as: // Enable navigation prompt window.onbeforeunload = function() { … Read more