I have popup and i get partialview from this code:
Common.Ajax({
type: "POST",
url: Common.QuanLyDaiLy.URL.CreateWizView,
async: false,
cache: false,
dataType: "html",
data: {
id: agentid
}
}, function (data) {
if (data != "") {
$("#modal-edit-agent").find(".modal-title").text((agentid == undefined || agentid.length < 1) ? "Tạo mới đại lý" : "Cập nhật đại lý");
$("#modal-edit-agent").find(".div-content").html(data);
$("#modal-edit-agent").modal("show");
Common.QuanLyDaiLy.RegisterEvent();
}
else {
Common.ShowAlert("Thông báo", "Có lỗi xảy ra.", {
Close: { Display: true },
}, "close");
return false;
}
Common.ShowLoading(false);
});
My popup contains:
<div class="row"> @using (Ajax.BeginForm("CreateWiz", "QuanLyDaiLy", null, new AjaxOptions { UpdateTargetId = "div-form-daily", HttpMethod = "POST", OnBegin = "QuanLyDaiLy.BeforeSend", OnFailure = "QuanLyDaiLy.Error", OnComplete = "QuanLyDaiLy.Success", InsertionMode = InsertionMode.Replace }, new { @class = "form-update", @role = "form", @id = "search-form" })) { <div class="col-xs-12 col-sm-12 col-md-12"> @Html.ValidationSummary(true) <div id="div-form-daily"> @Html.Partial("_CreateOrEdit", Model) </div> </div> <div class="col-xs-12 col-sm-12 col-md-12 text-center"> <button class="btn bg-maroon btn-cons btn-sm" type="submit"><i class="fa fa-floppy-o fa-lg"></i> Lưu</button> <button class="btn btn-default btn-sm" type="button" data-dismiss="modal"><i class="fa fa-refresh" aria-hidden="true"></i> Quay về</button> </div> } </div>
but when I got it from jquery ajax it not validate from client side and AjaxOptions : OnBegin, OnFailure, OnComplete not working not fire too.
Can somebody help me?