OnClientClick=“return confirm('Are you sure you want delete');”

前端 未结 2 1854
悲&欢浪女
悲&欢浪女 2021-01-04 03:42

I am using this code for confirmation on deletion. When I click on the link button, it asks me for confirmation, but the first time I click OK, the record is not get

相关标签:
2条回答
  • 2021-01-04 03:57
    <asp:LinkButton ID="LinkBtnDelete" runat="server" 
    OnClientClick="return confirm('Are you sure you want delete');" 
    CommandName="Delete" CommandArgument="">Delete 
    </asp:LinkButton>
    

    you must put CommandArgument so it will work from first time

    0 讨论(0)
  • 2021-01-04 04:05

    If the above answers doesn't workout for you then try below code:

    <asp:LinkButton ID="LinkBtnDelete" runat="server" 
    OnClientClick="if (!confirm('Are you sure you want delete?')) return false;" 
    CommandName="Delete">Delete 
    </asp:LinkButton>
    
    0 讨论(0)
提交回复
热议问题