1

我想从 DB .hard delete 中删除一个按钮单击的大量记录。我的要求是在删除之前提示用户两次。1.要删除吗??通过我已经完成的确认框 2.从按钮中的 cs 页面单击“你确定要删除 500 个项目”

<asp:Button ID="btnReviewAll" Visible="false" runat="server" Text="Review All" 
                        CssClass="button" ToolTip="Click to Review All" OnClick="btnReviewAll_Click" OnClientClick="javascript:return  confirm('Are you sure want to Review all Closed Items??');" />

在按钮中单击 .cs 页面我正在获取记录计数 ..如何提示用户继续并显示在任何确认框中。

protected void btnReviewAll_Click(object sender, EventArgs e)
        {
            try
            {
               List<Items> lstWorkItems = objBPC.GetCurrentWorkItems();
               //what to write here

            }
            catch (System.Exception ex)
            {
                Utils.DisplayMasterError(this.Page.Master, ex);
            }
4

2 回答 2

1

尝试使用javascript函数

<asp:Button ID="btnReviewAll" 
Visible="false" 
runat="server" 
Text="Review All" 
CssClass="button" 
ToolTip="Click to Review All" 
OnClick="btnReviewAll_Click" 
OnClientClick="javascript:confirmation();" />


<script>
function confirmation() {

    var yes = confirm("Are you sure want to delete that");

    if (yes) {

        var confirmyes = confirm("do you want to confirm delte");

        if (confirmyes) {
            return true;
        }

    }
    return false;

}

</script>
于 2013-04-16T09:51:04.273 回答
0

在尝试进行双重确认时发现了这一点。Rafee 发布的代码似乎不起作用。W3C 声明The confirm() method returns true if the user clicked "OK", and false otherwise.

所以这就是我用的;

    $('.disableConfirm').on('click', function(){

        if ( confirm('Confirm 1') ) {

            if ( confirm('Confirm 2') ){
                return true;
            }

        }
        return false;

    });
于 2016-04-25T13:23:39.003 回答