【问题标题】:Delete Row using Sweet alert in asp.net web forms在 asp.net 网络表单中使用 Sweet 警报删除行
【发布时间】:2020-09-04 05:58:43
【问题描述】:
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>

【问题讨论】:

  • 在您的甜蜜警报中是否正常工作?还有,你知道 ajax 吗?

标签: javascript asp.net webforms sweetalert


【解决方案1】:

只需在您的客户端点击事件中删除您的“return false”。如果您返回 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;
            }
        });
}

【讨论】:

    猜你喜欢
    • 2015-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-11-22
    相关资源
    最近更新 更多