此ajax
链接可正常运行,但添加此部分" new { @class = "delete" } "
后,在成功后未调用DEL_row()
。如果我删除此new { @class = "delete" }
然后将调用DEL_row()
。
代码如下:
@Ajax.ActionLink(" ",
"DeleteConfirmed",
new RouteValueDictionary { { "id", item.chanID } },
new AjaxOptions
{
InsertionMode = InsertionMode.Replace,
HttpMethod = "GET",
OnSuccess = "DEl_row('" + item.chanID + "')"
}, new { @class = "delete" })
答案 0 :(得分:0)
您正在尝试使用overload with the signature:
AjaxExtensions.ActionLink Method (AjaxHelper, String, String, Object, AjaxOptions, Object)
因此您的RouteValueDictionary
参数解释不正确,因此您需要使用匿名对象:
@Ajax.ActionLink(" ",
"DeleteConfirmed",
new { id = item.chanID },
new AjaxOptions
{
InsertionMode = InsertionMode.Replace,
HttpMethod = "GET",
OnSuccess = "DEl_row('" + item.chanID + "')"
}, new { @class = "delete" })
或者使用different overload,其中RouteValueDictionary
和html属性为IDictionary<string, Object>
@Ajax.ActionLink(" ",
"DeleteConfirmed",
new RouteValueDictionary { { "id", item.chanID } },
new AjaxOptions
{
InsertionMode = InsertionMode.Replace,
HttpMethod = "GET",
OnSuccess = "DEl_row('" + item.chanID + "')"
}, new Dictionary<string, Object>{ { "class", "delete"} })