Hi
In below code i want Delete Modal should be declared in Main Layout file & can be called in any View
<table class="table table-striped table-hover" id="tblLocation" style="width:100%">
<thead>
<tr>
<th>
@Html.DisplayNameFor(model => model.Location.Id)
</th>
@Html.DisplayNameFor(model => model.Location.Description)
@Html.DisplayNameFor(model => model.Location.IsActive)
<th>Action</th>
</tr>
</thead>
@foreach (var item in Model.Locations)
{
<td>
@Html.DisplayFor(model => item.Id)
</td>
@Html.DisplayFor(model => item.Description)
@if(item.IsActive)
<i class='fa fa-check' style="color:Highlight"></i>
}
else
<i class='fa fa-times' style="color:red"></i>
<a class='btn btn-primary btn-sm' id='btnEdit'><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="#DeleteModal-@item.Id" style='margin-left:5px'><i class='fa fa-trash'></i> Delete </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="DeleteModal-@item.Id">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-danger">Delete Confirmation</h4>
</div>
<div class="modal-body">
<p>Are you sure you want to delete this record ?</p>
<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>
</table>
************************ Below part i want to be declared in Main Layout
Thanks