I created a project to use ajax for the first time and it all seems to be working other than the insertion mode
mvc 5 VB Home - index view first up.
@Using (Ajax.BeginForm("UserEmail", "Home", _
New AjaxOptions _
With {.InsertionMode = InsertionMode.InsertAfter,
.HttpMethod = "GET",
.LoadingElementId = "LoadingDisplay",
.UpdateTargetId = "Users"}))
@<text>
<div class="container body-content">
<br />
<input type="text" name="email" class="form-control col-lg-6" placeholder="Account holders email address" />
<input type="submit" value="search" class="btn btn-primary" style="margin-left:5px; margin-bottom:5px;" />
<img id="ajax-loader" src="~/Content/images/ajax-loader.gif" style="display:none" />
</div>
</text>
End Using
<div id="Users">
</div>
<div id="Display">
@Ajax.ActionLink("Click Me", "UserEmail", _
New AjaxOptions With {
.UpdateTargetId = "Display",
.InsertionMode = InsertionMode.Replace,
.HttpMethod = "GET"})
</div>
The Problem:
When I use either of the ajax calls the input and button disappear and get replaced with the partial result and it isn't formatted very well with a table going off page needing to be scrolled. I'm under the impression that the 2 controls should stay in viewed and the ajax begin form should update the div and the ajax action update itself?
Function UserEmail(email As String) As ActionResult
Dim result = db.AspNetUsers.Include("AspNetUserRoles").ToList
Return PartialView("_UsersInRoles", result)
End Function