So i am using ajax.beginform to load the data and for some reason the results are loaded in a new page. everything ive read online leads me to believe its because im not including the right scripts but im struggling to figure out what im doing wrong. I even tried adding the script tags to the top of each view and the results were the same.
Here is my _Layout.cshtml
<div class="container body-content">
@RenderBody()
<hr />
<footer>
<p>© @DateTime.Now.Year - AL SE Tool</p>
</footer>
</div>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/jqueryval")
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("scripts", required: false)
The Controller
public ActionResult CheckCust(ClientCheckModels clientCheck)
{
CustomerInfo custInfo = new CustomerInfo(clientCheck.CustomerId);
DataModel dataModel = custInfo.GetClientData();
return PartialView("_ClientResults",dataModel);
}
The main view
<div id="clientdata">
@using (Ajax.BeginForm("CheckCust", "ClientCheck", new AjaxOptions { HttpMethod = "GET", UpdateTargetId = "clientdata", InsertionMode = InsertionMode.Replace }))
{
<div class="form-group">
@Html.LabelFor(model => model.CustomerId, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.CustomerId, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.CustomerId, "", new { @class = "text-danger" })
</div>
</div>
<input type="submit" value="Submit" class="btn btn-default" />
}
<br /><br />
@{Html.Partial("_ClientResults", Model);}
</div>
The partial view
@model SETools.Models.DataModel
<br />
@if(Model != null)
{
<h3>Threat Appliances<small>@Html.DisplayFor(model => model.ThreatManager.Appliances.Count)</small></h3>
<h3>Protected Hosts <small>@Html.DisplayFor(model => model.ThreatManager.ProtectedHosts.Count)</small></h3>
<h3>Hosts with Errors <small>@Html.DisplayFor(model => model.ThreatManager.HostErrors)</small></h3>
<h3>New Hosts <small>@Html.DisplayFor(model => model.ThreatManager.HostNew)</small></h3>
<h3>Ok Hosts <small>@Html.DisplayFor(model => model.ThreatManager.HostOk)</small></h3>
<h3>
<rest removed to shave space>