I have a ViewModel which has the list of different products.
Each product has its own description, albume, title, description, price and etc..
Foreach(var product in Model)
{
<img src="/productImage/@product.ImageName"/>
}
How can I show each product’s individual contents when I click on its Image using popup modal ?
2
Answers
I would include individual description to data attribute, like data-description="Your description goes here …" , then, when image clicked, get this data attribute value and dynamically modify the modal content.
You could use Bootstrap Modal like below:
Model:
View(Index.cshtml):
Controller:
Result: