for now I have a pop up modal box with some details from my model. It pops up when a user clicks on a list item. What i did i have added the Modal into a foreach loop which i know is not the best way of doing it. It works but it creates a modal per list item...
Is there a way of having the modal outside the foreach loop and just populating the content on click event?
This is my modal: and foreach loop
@foreach (var item in Model.Where(p => p.CurrentStatus == "Start" && p.member == "budyn"))
{
<!-- Modal -->
<div class="modal fade" id="myModal" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">@item.JobID</h4>
</div>
<div class="modal-body">
<p>@item.JobTitle</p>
<!-- etc... -->
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<li class="list-group-item"> <a data-toggle="modal" data-target="#myModal">@item.JobID @item.JobTitle </a> </li>
}
Here you can proceed like.
Your list of rows
Your modal outside to the loop
On modal open
See for more details about bootstrap events https://getbootstrap.com/javascript/#modals-related-target