views:

230

answers:

1

Hi,

I currently have a product view page that contains an MVCContrib HTML Grid with a select link at the beginning of each row. If the select link is clicked, it takes me to a different page.

My question is whether it is possible to retrieve the productID from the row that is selected and pass that to the next page.

Maybe this is posible to do with a session variable but im not sure.

Any help would be greatly appreciated.

Thanks in advance.

Here is my view code:

<% Html.Grid((List<System2__MVC2.Controllers.ProductController.ProductsSet>)ViewData["Products"]).Columns(column =>
       {
           column.For(c => Html.ActionLink("Select", "Products", "Product")).DoNotEncode();
           column.For(c => c.ProductID);
           column.For(c => c.Name);
           column.For(c => c.Description);
           column.For(c => c.Price);

       }).Render();             
%>
A: 

Maybe I'm misunderstanding your question, but couldn't you just pass the ProductID as a route value to the ActionLink method? Something along the lines of:

Html.ActionLink("Select", "Products", "Product", new { ID = c.ProductID }, null)
Jonas H
Ah... Thank you very much, Im new to ASP MVC and did not realise you could do that.Thanks again.
RyanDreggs