Ajax.ActionLink is not POSTing
Posted
by Dave Hanna
on Stack Overflow
See other posts from Stack Overflow
or by Dave Hanna
Published on 2010-06-17T20:48:46Z
Indexed on
2010/06/17
20:53 UTC
Read the original article
Hit count: 570
I am trying to navigate to an MVC action by POSTing rather than GETting. (The action is a DELETE, and I don't want it reachable by an external link.)
I am using a link in a grid generated by
Ajax.ActionLink("Remove", "Delete", new { saID = Model.Said, id = e.id }, new AjaxOptions { HttpMethod = "POST", Confirm = "Are you sure you want to delete this item?" })
Which generates the following HTML:
<a href="/Equipment/Delete/102424/229933" onclick="Sys.Mvc.AsyncHyperlink.handleClick(this, new Sys.UI.DomEvent(event), { insertionMode: Sys.Mvc.InsertionMode.replace, confirm: 'Are you sure you want to delete this item?', httpMethod: 'POST' });">Remove</a>
My problem is that when I click on the link, I am reaching the Delete action via a GET rather than a POST, AND the Confirm dialog is not taking place. I have been googling this for several hours and just keep getting wrapped around the axle. What am I doing wrong?
© Stack Overflow or respective owner