簡體   English   中英

是否需要從DB刪除ITEM的雙重確認?

[英]Double confirmation for deleting ITEM from DB?

我想從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);
            }

嘗試使用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>

嘗試進行雙重確認時發現了這一點。 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;

    });

暫無
暫無

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

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