微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

在ASP.NET C#中发出甜蜜警报之前验证表单

如何解决在ASP.NET C#中发出甜蜜警报之前验证表单

当我单击提交按钮甜蜜警报打开时,我正在通过提交表单上的JavaScript使用显示甜蜜警报,当我单击确定时,它将在POST上验证表单... 我想在甜蜜提醒显示之前进行验证。.

function createtransaction(btnsubmit) {

if (btnsubmit.dataset.confirmed) {
    // The action was already confirmed by the user,proceed with server event
    btnsubmit.dataset.confirmed = true;
    return true;
} else {
    event.preventDefault();
    swal({
        title: "Are you sure?",text: "Once you create Escrow Transaction,Invitation will be sent to the other party!",icon: "warning",buttons: true,dangerMode: true,})
    .then((willDelete) => {
        if (willDelete) {

            swal("Escrow Transaction invitation has been sent successfully!",{
                icon: "success",}).then(function () {
                // Set data-confirmed attribute to indicate that the action was confirmed
                btnsubmit.dataset.confirmed = true;
                // Trigger button click programmatically
                btnsubmit.click();

            })
        }
        else {
            swal("Escrow Transaction invitation has been cancelled",{
                icon: "error",});
        }
    });
}}

并且按钮代码

 <asp:Button ID="btnsubmit" runat="server" class="btn btn-primary" Style="float: right" Text="Submit" OnClick="btnsubmit_Click" OnClientClick="return createtransaction(this);" />

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。