This ajax
link works correctly but when this part " new { @class = "delete" } "
added didn't call the DEL_row()
after success. If i remove this new { @class = "delete" }
then DEL_row()
will be called .
Code is as below:
@Ajax.ActionLink(" ",
"DeleteConfirmed",
new RouteValueDictionary { { "id", item.chanID } },
new AjaxOptions
{
InsertionMode = InsertionMode.Replace,
HttpMethod = "GET",
OnSuccess = "DEl_row('" + item.chanID + "')"
}, new { @class = "delete" })
You are trying to use the overload with the signature:
AjaxExtensions.ActionLink Method (AjaxHelper, String, String, Object, AjaxOptions, Object)
So your RouteValueDictionary
parameter is interpreted incorrectly so you need to use an anonymous object instead:
@Ajax.ActionLink(" ",
"DeleteConfirmed",
new { id = item.chanID },
new AjaxOptions
{
InsertionMode = InsertionMode.Replace,
HttpMethod = "GET",
OnSuccess = "DEl_row('" + item.chanID + "')"
}, new { @class = "delete" })
Or use a different overload which takes a RouteValueDictionary
and the html attributes as a 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"} })