这是我的ActionLink剃须刀按钮:
@Html.ActionLink("Delete Partial", "DeletePartialView", new { id = item.ClubID }, new { @class = "btn btn-danger btn-xs" })
如何为id
分配deleteClub-opener
,以便在点击它时调用此jQuery代码:
$("#deleteClub-opener").click(function () {
$("#DelteClub-dialog").dialog("open");
});
答案 0 :(得分:2)
您已经通过class
属性向元素添加了HtmlAttributes
,您只需添加所需的id
:
@Html.ActionLink(
"Delete Partial",
"DeletePartialView",
new { id = item.ClubID },
new {
@class = "btn btn-danger btn-xs",
id = "deleteClub-opener" // <- add the id here
})
的更多信息