I have a list (grid) and want to open a modal bootstrap with details of the chosen line.
To build the list I'm using - @foreach
, and I store the data in viewbag
.
The idea is to open the modal window and use the data of viewbag
.
@foreach (var _img in ViewBag.Images)
{
<a href="#modal60" data-toggle="modal">
<img src="~/Content/images/products/@_img.MediaFileName" />
</a>
ViewBag.ImageFile = _img.MediaFileName;
ViewBag.ImageId = _img.ProductsMediasId;
}
The problem is that ViewBag.ImageFile
does not have the correct value of the selected image.