Consider the following ViewModel class:
public class ViewModeStudent { public string Value { get; set; } public int Id { get; set; } }
Now you want the edit page to store the ID but have it not be seen:
<% using(Html.BeginForm() { %> <%= Html.HiddenFor(model.Id) %><br /> <%= Html.TextBoxFor(model.Value) %> <% } %>
Which results in the equivalent of the following HTML:
<form name="form1"> <input type="hidden" name="Id">2</input> <input type="text" name="Value" value="Some Text" /> </form>