Hi
Partial View
@using (Html.BeginForm("CreateEdit", "Location", FormMethod.Post))
{
@Html.AntiForgeryToken()
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
<div class="modal" tabindex="-1" role="dialog" id="UpSertModal">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title"></h4>
</div>
<div class="modal-body">
<div class="form-horizontal">
<div class="form-group">
@Html.LabelFor(model => model.Id, htmlAttributes: new { @class = "control-label col-md-3" })
<div class="col-md-3">
@Html.EditorFor(model => model.Id, new { htmlAttributes = new { @class = "form-control"} })
@Html.ValidationMessageFor(model => model.Id, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.Description, htmlAttributes: new { @class = "control-label col-md-3" })
<div class="col-md-9">
@Html.EditorFor(model => model.Description, new { htmlAttributes = new { @class = "form-control"} })
@Html.ValidationMessageFor(model => model.Description, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.IsActive, htmlAttributes: new { @class = "control-label col-md-3" })
<div class="col-md-2">
@Html.CheckBoxFor(model => model.IsActive, new { @checked = (Model.IsActive == true ? "checked" : "") })
@Html.ValidationMessageFor(model => model.IsActive, "", new { @class = "text-danger" })
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
<button type="submit" class="btn btn-primary">Save Changes</button>
</div>
</div>
</div>
</div>
}
Js File
$('body').on('click', '[id*=btnAdd]', function () {
$("#hfAU").val("A");
$.get("/Location/CreateEdit?Id=" + Id, function (data) {
$("#divData").html(data);
$("#UpSertModal").modal('show');
});
});
Index file
<input type="hidden" id="hfId" />
<input type="hidden" id="hfAU" value="A" />
<script src="~/Scripts/Appjs/Location.js"></script>
Thanks