I have a foreach loop which loops through my documents from a database, it only pulls in the IMAGES then I have a 4 images per row on my page, I would like to click one it opens a Modal with the image, click another same again. So i have this setup:
@foreach (var item in Model.DocumentList)
{
// Below I am currently using just a ID for modal (which i know is wrong)
<div class="col-lg-3 col-md-4 col-xs-6 thumb">
<a class="thumbnail" data-toggle="modal)" data-target="#myModal" title="@item.FileDescription">
@Html.DocumentUrl(item.FileUrl, false)
</a>
<span class="col-xs-12" style="text-align:center;">@item.CreatedDate.ToShortDateString()</span>
</div>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<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" id="myModalLabel">Uploaded - @item.CreatedDate.ToShortDateString()</h4>
</div>
<div class="modal-body">
@Html.DocumentUrl(item.FileUrl, true)
<div class="row">
<div class="col-md-12">
<p>
@item.FileDescription
</p>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn banner-background white-text">Download</button>
</div>
</div>
</div>
</div>
}
I can see why the data-target id modal isn't working, when I hover it works i see the different title, however when I click the img even if I click img 4 it just shows the first img, first title etc. How can I do this so it works with each item properly? Also changing id modal to a class doesn't help either.