I have problem passing hidden field value in actionlink parameter:
productView:
@Html.ActionLink("ProductCompare",
"ProductCompare",
new { ProductIds= **hdnSelectedProductId**)
@Html.Hidden("hdnSelectedProductId")
Controller Action:
public ActionResult ProductCompare(string ProductIds)
{
return View();
}
When user select any product i keep putting product ids in hdnSelectedProductId using javascript. Now when user click on ProductCompare link i want to pass this hidden field value to controller. Please guide me.
One solution is to use jQuery to attach a click event which would read the hidden field and append it to the link's href attribute.
The other solution is to store the value, if you know what it would be, in ViewData and use it instead of hidden field value.