Are you tired of Partial Views causing your whole page to reload? Well... frankly so was I until I found this cool solution:
1) Install NuGet: Microsoft.jQuery.Unobtrusive.Ajax
2) To the main View, add these scripts:
3) In the partial view, wrap the whole thing in a div with ID, and replace Html.BeginForm with Ajax.BeginForm:
@using (Ajax.BeginForm("UpdateUser", "Account", new AjaxOptions
HttpMethod = "POST",
InsertionMode = InsertionMode.ReplaceWith,
UpdateTargetId = "UpdateUserId"
- Notice how the div id and UpdateTargetId are the same string.
And that should be working correctly.