Hi
In below code Html.Beginform portion can be called thru Partial View.
@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'><i class='fa fa-pencil'></i> Edit </a> <a class='btn btn-danger btn-sm disabled' id='btnDelete' style='margin-left:5px'><i class='fa fa-trash'></i> Delete </a>
@using (Html.BeginForm("DeleteLocation", "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"> <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button> <h4 class="modal-title">Delete Confirmation</h4> <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> } </td> </tr> }
************************************* I want below code to be created as Partial View . To This Action , Controller , Parameter should be passed
@using (Html.BeginForm("DeleteLocation", "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"> <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button> <h4 class="modal-title">Delete Confirmation</h4> <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> Thanks