When using strongly typed helpers in MVC2 the input field values aren\'t taken from the Model property when a post is made. Is this default behavior?
(strong
When using strongly typed helpers in MVC2 the input field values aren't taken from the Model property when a post is made. Is this default behavior?
Yes, they are first taken from the ModelState and then from the Model. If you intend to perform some modifications on the model in your POST action you need to remove them from the ModelState first. For example:
[HttpPost]
public ActionResult Edit(Product p)
{
ModelState.Remove("Name");
p.Name = "prrrrrrd 2";
return View(p);
}