Yes No Confirm Box using jQuery SweetAlert plugin in ASP.Net

Last Reply 11 months ago By dharmendr

Posted 11 months ago

I am trying to replace Alert with Bootstrap alert but not able find perfect solution.

I want to pop alert box with Yes or No. If user select Yes than process resumes with operations. If user select No the current pop will hide.

Any help will be appreciated.

            var me = $(this);
            if ('requestRunning')) {
  'requestRunning', true);
            if (confirm("Do you want to delete ?")) {
                var row = $(this).closest("tr");
                var ProductID = {
                    ProductID: row.find(".ProductID").find("span").html()

                    type: "POST",
                    url: '@Url.Action("DeleteData", "Product")',
                    data: JSON.stringify(ProductID),
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    success: function (response) {
  'requestRunning', false);



Posted 11 months ago Modified on 11 months ago

Hi yogesjoshi,

You can use any plugin like sweetalert plugin to achieve this.

Refer the below sample and implement in your code.


<html xmlns="">
<head runat="server">
    <script type="text/javascript" src=""></script>
    <script type="text/javascript" src=""></script>
    <script type="text/javascript" src=""></script>
    <link rel="stylesheet" href="" />
    <script type="text/javascript" src=''></script>
    <link media="screen" rel="stylesheet" href='' />
    <link media="screen" rel="stylesheet" href='' />
    <script type="text/javascript">
        function functionConfirm(event) {
                title: 'Do you want to delete ?',
                showCancelButton: true,
                showConfirmButton: true,
                confirmButtonText: 'Yes',
                cancelButtonText: 'No',
                confirmButtonClass: 'btn btn-success',
                cancelButtonClass: 'btn btn-danger',
                type: 'warning',
                buttonsStyling: false
            }).then(function (yes) {
                // Called if you click Yes.
                if (yes) {
                    // Make Ajax call.
                    swal('Deleted', '', 'success');
            function (no) {
                // Called if you click No.
                if (no == 'cancel') {
                    swal('Cancelled', '', 'error');
        <input type="submit" value="Delete" id="btnDelete" class="btn btn-danger" onclick="functionConfirm(this); return false;" />