View:
@using (Html.BeginForm("UpdateMaterial", "MyController", FormMethod.Post, Model.MaterialId))
{
@Html.AntiForgeryToken()
<input type="submit" class="btn btn-primary custom" value="Derivate Material" />
}
Controller:
[HttpPost]
public ActionResult UpdateMaterial(int? matId)
{
if (matId == null)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
//do something here
}
The Id I send its always null. How do i change this?