OnClientClick ="返回确认('您确定要删除');" [英] OnClientClick="return confirm('Are you sure you want delete');"

查看:148
本文介绍了OnClientClick ="返回确认('您确定要删除');"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用此代码进行删除确认。当我点击链接按钮时,它会要求我确认,但是第一次点击确定时,记录不会被删除(仅限第一次)

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 getting deleted (only for the first time).

此后该记录成功删除。

<asp:LinkButton ID="LinkBtnDelete" runat="server" 
OnClientClick="return confirm('Are you sure you want delete');" 
CommandName="Delete">Delete 
</asp:LinkButton> 

任何帮助都会很棒,谢谢。

Any help would be great, thank you.

推荐答案

如果以上答案没有为您锻炼,请尝试以下代码:

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>

这篇关于OnClientClick =&quot;返回确认('您确定要删除');&quot;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆