Here’s the view
@using (Html.BeginForm("Deleted", "Location"))
{
Html.Hidden("LocationID", Model.LocationID );
<input type = "submit" value = "Delete" />
}
And here’s the method that’s supposed to receive the data.
public ActionResult Deleted(int LocationID)
{
//Do something with LocationID
return View();
}
When I run the code, LocationID is always null. Am I missing something?
Thanks for helping
Calling
Html.Hiddenreturns anIHtmlStringcontaining a hidden field.However, you aren’t doing anything with the returned string.
You need to render the string to the page using an
@.