I'd like to do something simple. I've got a list of products (with a name attribute) with a "details" button next to each. When I click on the button, I want the details of the product to be displayed next to the list (unexpected, I know ^^).
What I've done so far:
Displayed the list of products - a name and button displayed for each product:
@foreach (var product in item.Value) {
<div>id : @product.product.PRODUCT_ID , name : @product.product.PRODUCT_NAME @Html.ActionLink("Details", "ProductDetails", new { id = product.product.PRODUCT_ID }, null)</div>
}
The displaying of the details of a product in another page:
@model IEnumerable<MyService.PRODUCT>
<table>
<tr>
<th>
@Html.DisplayNameFor(model => model.EPC_NUMBER)
</th>
<th>
@Html.DisplayNameFor(model => model.PRODUCT_NAME)
</th>
<th>
@Html.DisplayNameFor(model => model.MANUFACTURING_DATE)
</th>
<th></th>
</tr>
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.EPC_NUMBER)
</td>
<td>
@Html.DisplayFor(modelItem => item.PRODUCT_NAME)
</td>
<td>
@Html.DisplayFor(modelItem => item.MANUFACTURING_DATE)
</td>
</tr>
}
</table>
What I want to do now : ling the 2 in the same view. When I click on the details button, a function of my controller is called with the product.id as parameter then display the details of the product. How to do what I want ? Thanks !