簡體   English   中英

在 asp.net web 表單中使用 Sweet alert 刪除行

[英]Delete Row using Sweet alert in asp.net web forms

function del() {
        swal({
            title: "Are you sure?",
            text: "Once deleted, you will not be able to recover this imaginary file!",
            icon: "warning",
            buttons: true,
            dangerMode: true,
        })
            .then((willDelete) => {
                if (willDelete) {
                  
                    swal("Poof! Your imaginary file has been deleted!", {
                        icon: "success",
                    });
                } else {
                    swal("Your imaginary file is safe!");
                }
            });
    }

和我的鏈接按鈕代碼是請幫助我如何在中繼器中使用鏈接按鈕時使用甜蜜警報

<asp:LinkButton ID="delete_lbtn" runat="server" class="btn btn-danger btn-sm" 
CausesValidation="false" OnClick="delete_lbtn_Click" OnClientClick="del(); return false;"> 
<i class="nav-icon i-Close-Window"> Delete</i></asp:LinkButton>

只需在您的客戶端點擊事件中刪除您的“返回假”即可。 如果您返回 false,服務器端代碼將不會運行,但如果您返回 try,則將運行。 因此:

function del() {
    swal({
        title: "Are you sure?",
        text: "Once deleted, you will not be able to recover this imaginary file!",
        icon: "warning",
        buttons: true,
        dangerMode: true,
    })
        .then((willDelete) => {
            if (willDelete) {
              
                swal("Poof! Your imaginary file has been deleted!", {
                    icon: "success",
                });
                return true;
            } else {
                swal("Your imaginary file is safe!");
                return false;
            }
        });
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM