Note that there are some explanatory texts on larger screens.

plurals
  1. POpopup window that connects to database mvc 4 asp.net
    primarykey
    data
    text
    <p>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?</p> <p><strong>The view</strong></p> <pre><code>@model IEnumerable&lt;ProductViewModel&gt; @{ ViewBag.Title = "View1"; } &lt;div id="productList"&gt; @foreach (var item in Model) { &lt;a href="@Url.Action("OpenModel", "Product", new { id = item.ProductId })", data-otf-ajax="true" data-otf-target="#openModal"&gt; &lt;img width="75" height="75" src="@Url.Action("GetImage", "Product", new { id = item.ProductId })" /&gt; &lt;/a&gt; } &lt;/div&gt; </code></pre> <p><strong>Partial View</strong></p> <pre><code>@model Product &lt;div id="openModal" class="modalDialog"&gt; &lt;div&gt; &lt;a href="#close" title="Close" class="close"&gt;X&lt;/a&gt; &lt;h2&gt;Product Information&lt;/h2&gt; &lt;h3&gt; &lt;img width="75" height="75" src="@Url.Action("GetImage", "Product", new { id = Model.ProductId })" /&gt; &lt;strong&gt;@Model.Name, @Model.Category&lt;/strong&gt; &lt;/h3&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p><strong>Rendered HTML from the View</strong></p> <pre><code>&lt;div id="productList"&gt; &lt;a href="#openModal"&gt; &lt;img width="75" height="75" src="/Product/GetImage/10" /&gt; &lt;/a&gt; &lt;div id="openModal" class="modalDialog"&gt; &lt;div&gt; &lt;a href="#close" title="Close" class="close"&gt;X&lt;/a&gt; &lt;h2&gt;Product Information&lt;/h2&gt; &lt;h3&gt; &lt;img width="75" height="75" src="/Product/GetImage/10" /&gt; &lt;strong&gt;Fancy Hat, Hat&lt;/strong&gt; &lt;/h3&gt; &lt;/div&gt; &lt;/div&gt; &lt;a href="#openModal"&gt; &lt;img width="75" height="75" src="/Product/GetImage/11" /&gt; &lt;/a&gt; &lt;div id="openModal" class="modalDialog"&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload