We have a list of items. When an item is clicked a window should pop up with the details of that item. Problem is no matter which image we click on the first in the list is displayed. The id is not being passed. Any ideas?
The view
@model IEnumerable<ProductViewModel>
@{
ViewBag.Title = "View1";
}
<div id="productList">
@foreach (var item in Model)
{
<a href="@Url.Action("OpenModel", "Product", new { id = item.ProductId })",
data-otf-ajax="true" data-otf-target="#openModal">
<img width="75" height="75"
src="@Url.Action("GetImage", "Product", new { id = item.ProductId })" />
</a>
}
</div>
Partial View
@model Product
<div id="openModal" class="modalDialog">
<div>
<a href="#close" title="Close" class="close">X</a>
<h2>Product Information</h2>
<h3>
<img width="75" height="75"
src="@Url.Action("GetImage", "Product", new { id = Model.ProductId })" />
<strong>@Model.Name, @Model.Category</strong>
</h3>
</div>
</div>
Rendered HTML from the View
<div id="productList">
<a href="#openModal">
<img width="75" height="75" src="/Product/GetImage/10" />
</a>
<div id="openModal" class="modalDialog">
<div>
<a href="#close" title="Close" class="close">X</a>
<h2>Product Information</h2>
<h3>
<img width="75" height="75" src="/Product/GetImage/10" />
<strong>Fancy Hat, Hat</strong>
</h3>
</div>
</div>
<a href="#openModal">
<img width="75" height="75" src="/Product/GetImage/11" />
</a>
<div id="openModal" class="modalDialog">
Product Information