Use the OnBegin event:
@Ajax.ActionLink("Done", "ActionName", new AjaxOptions { OnBegin = "return ConfirmDone()", UpdateTargetId = "MyContainerId" })
You can also use the Confirm ajax option if all you have to do is open a confirmation window. If you need to do more custom logic (or want to use a custom dialog), you will need to use OnBegin.
Here is an example using Confirm:
@Ajax.ActionLink("Done", "ActionName", new AjaxOptions { Confirm= "Are you sure you want to do this?", UpdateTargetId = "MyContainerId" })
Dismissile
source share