Hi
When i click on Add/Update button below Partial View is called. I want when clicked on Updat Button then it should display values .
If Add then all should be Blank,
********************************************************************************
@foreach (var item in Model.Locations)
{
@Html.DisplayFor(model => item.Id)
@Html.DisplayFor(model => item.Description)
Edit
}
@model MyApplication.Models.Location
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
@*@Html.HiddenFor(model => model.Id)*@
@Html.LabelFor(model => model.Id, htmlAttributes: new { @class = "control-label col-md-3" })
@Html.EditorFor(model => model.Id, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Id, "", new { @class = "text-danger" })
@Html.LabelFor(model => model.Description, htmlAttributes: new { @class = "control-label col-md-3" })
@Html.EditorFor(model => model.Description, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Description, "", new { @class = "text-danger" })
@Html.LabelFor(model => model.GstStateCode, htmlAttributes: new { @class = "control-label col-md-3" })
@Html.EditorFor(model => model.GstStateCode, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.GstStateCode, "", new { @class = "text-danger" })
@Html.LabelFor(model => model.GstStateName, htmlAttributes: new { @class = "control-label col-md-3" })
@Html.EditorFor(model => model.GstStateName, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.GstStateName, "", new { @class = "text-danger" })
@Html.LabelFor(model => model.GstNo, htmlAttributes: new { @class = "control-label col-md-3" })
@Html.EditorFor(model => model.GstNo, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.GstNo, "", new { @class = "text-danger" })
*************************************************************************
$('body').on('click', '[id*=btnAdd]', function () {
$(".modal-title").html("Add new location");
$('#myModal').modal('show');
});
$(document).on('click', '[id*=btnEdit]', function () {
$(".modal-title").html("Update");
$('#myModal').modal('show');
});
Thanks
Sachin SinghPosted Jun 17, 2021, 6:23 AM
Ramco RamcoPosted Jun 16, 2021, 2:57 PM
Hi Sachin
How the below code works
$('body').on('click', '[id*=btnAdd]', function () {
$.get("/Controller/Add",function(myHtml){
$(".modal-body").Html(myHtml);
)
Thanks
Sachin SinghPosted Jun 16, 2021, 8:52 AM
Sachin SinghPosted Jun 16, 2021, 8:31 AM
class
="modal-title">Add New Product