To edit a record, I'm opening a modal Kendo UI window populated with a partial view containing an AJAX enabled form:
@model MVC_ACME_Hardware.Models.BaseModel
<script type="text/javascript">
$(function () {
$("form").kendoValidator();
});
</script>
@using (Ajax.BeginForm("EditProduct", new AjaxOptions { UpdateTargetId = "ProductDiv", OnSuccess = "SomeMethod" }))
{
@Html.ValidationSummary(true)
<fieldset>
<legend>EmployeeFTE</legend>
@Html.HiddenFor(model => model.Products.Product_ID)
<div class="editor-label">
@Html.LabelFor(model => model.Products.Product_Name)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Products.Product_Name)
@Html.ValidationMessageFor(model => model.Products.Product_Name)
</div>
<input type="submit" value="Save" class="myButton" />
</fieldset>
}
When I run the form and click 'Save' on the popup, the form posts successfully but the post is not done via AJAX and my 'SomeMethod' onsuccess method is not being called. I've tried adding...
<script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.min.js")" type="text/javascript"></script>
...on the partial view but it did not help. How can I get my form to submit using AJAX? I'm missing something obvious. Thanks!