I'm looping through a model and iterating through data. I want to add a button on each item that generates an action/id.
As I cannot add a url to a button , I've decided to use a form with the following:
<form action="@Url.Action("ItemDetail", new { itemId = @quote.Item.ItemID})">
<button class="btn-bg btn-sm btn-inverse btn-fix-width" type="submit">
<i class="fa fa-th-list fa-fw pull-right"></i>View RFQ
</button>
</form>
I opted for a button instead of input type to inset font-awesome icons.
However, I get /Quote/ItemDetail? as opposed to /Quote/ItemDetail?itemId=123
I'm using T4MVC
Controller:
public virtual ActionResult ItemDetail(int ItemID)
{
return View();
}
RouteConfig:
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }