How can i make a confirm question using Ajax?
this is my button:
@Html.ActionLink("Deletar", "Deletar", new { id = item.ID })
I tried to make a confir开发者_JAVA技巧m question with Ajax like this
@using (Ajax.BeginForm(
"AjaxAction",
new AjaxOptions {OnBegin ="Deletar",Confirm="Você realmente deseja isso?" }))
{ @Html.ActionLink("Deletar", "Deletar", new { id = item.ID },new { id = "Deletar" }) }
it does not work? what can i do?
With standard link:
@Html.ActionLink(
"Deletar",
"Deletar",
new { id = item.ID },
new { onclick = "return confirm('Você realmente deseja isso?');" }
)
or if you want to use an AJAX link:
@Ajax.ActionLink(
"Deletar",
"Deletar",
new { id = "item.ID" },
new AjaxOptions { OnBegin = "Deletar", Confirm = "Você realmente deseja isso?" }
)
or an AJAX form:
@using (Ajax.BeginForm("AjaxAction", new { id = item.ID }, new AjaxOptions { OnBegin = "Deletar", Confirm = "Você realmente deseja isso?" }))
{
<input type="submit" value="Deletar" />
}
精彩评论