删除ActionLink的与确认对话框 [英] Delete ActionLink with confirm dialog
本文介绍了删除ActionLink的与确认对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想实现一个简单的 ActionLink的
将删除使用ASP.NET MVC的记录。这是我到目前为止有:
I'm trying to implement a simple ActionLink
that will delete records using ASP.NET MVC. This is what I have so far:
<%= Html.ActionLink("Delete",
"Delete",
new { id = item.storyId,
onclick = "return confirm('Are you sure?');"
})%>
然而,它不显示确认框。显然,我失去了一些东西还是我错误地建立了链接。谁能帮助?
However, it doesn't show the confirm box. Clearly I'm missing something or I have incorrectly built the link. Can anyone help?
推荐答案
不要混淆 routeValues
与 htmlAttributes
。你可能想此重载:
Don't confuse routeValues
with htmlAttributes
. You probably want this overload:
<%= Html.ActionLink(
"Delete",
"Delete",
new { id = item.storyId },
new { onclick = "return confirm('Are you sure you wish to delete this article?');" })
%>
这篇关于删除ActionLink的与确认对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文