开发者

Javascript confirm before running the eventhandler, which deletes records from the database

开发者 https://www.devze.com 2022-12-26 14:28 出处:网络
I have button, which fires an event, that deletes a record from the database开发者_如何学JAVA. This is the source of the button:

I have button, which fires an event, that deletes a record from the database开发者_如何学JAVA. This is the source of the button:

<asp:Button ID="btnDelete" runat="server" Text="Delete" onclick="btnDelete_Click" />

But how can I make a confirm box appear before the deletion?


Use the button's OnClientClick property:

<asp:Button ID="btnDelete" runat="server" OnClientClick="confirmDelete" ... >

<script type="text/javascript">
function confirmDelete()
{
  return confirm('Really delete this record?');
}
</script>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号