I\'m just trying to get back into .NET MVC with the new release and I can\'t get my head round the way may view is binding to the DataModel.
I have a model with a pr
Because HTML helpers read the value from the ModelState and not from the model. In order the change that behavior you'll need to work with the ModelState as well.
(see: Changing model’s properties on postback)
This should work for the first two:
<%= Html.TextBox("first_name", x => x.first_name)%>
<%= Html.TextBoxFor(model => model.first_name) %>
You need to clear your model state so your code would look something like:
[HttpPost]
public ActionResult Register(Registration model)
{
ModelState.Clear();
model.first_name = "Steve";
return View(model);
}