Hi
@foreach (var item in Model) { <tr> <td> @Html.DisplayFor(modelItem => item.Id) </td> <td> @Html.DisplayFor(modelItem => item.Description) </td> <td> @Html.DisplayFor(modelItem => item.IsActive) </td> <td> <a class='btn btn-primary btn-sm' id='btnEdit' data-target="#myModal" data-toggle="modal"><i class='fa fa-pencil'></i> Edit </a>
@if (item.IsActive) { <a id="btnDelete" class="btn btn-danger btn-sm" data-toggle="modal" data-target="#[email protected]" style='margin-left:5px'><i class='fa fa-trash'></i>Delete</a> } else { <a class='btn btn-danger btn-sm disabled' id='btnDelete' style='margin-left:5px'><i class='fa fa-trash'></i> Delete </a> } </td>
@using (Html.BeginForm("Delete", "Location", new { id = item.Id }, FormMethod.Post, null)) { @Html.AntiForgeryToken() <div class="modal" tabindex="-1" role="dialog" id="[email protected]"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title">Delete Confirmation</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body"> <p>Are you sure you want to delete this record ?</p> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button> <button type="submit" class="btn btn-danger">Delete</button> </div> </div> </div> </div> } </tr> }
Thanks