开发者

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" />
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜