1
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 store the data in a viewbag
.
The idea is to open the modal window and use the data from 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 get the correct value of the selected image.
You already own the
modal
? Post the rest of your code along with the method for details.– Randrade
Hello, we don’t do this way jerally as there is no need to save the details of all items on the same page. A more interesting approach would be when you click on the item to see the details the page makes a request to the server and returns only the detail of the item in question.
– Luã Govinda Mendes Souza