Route data vs. Model data – who wins?
Q: If we have in route defined parameter with same name as property at model and then we call it from strongly typed HTML helper (for example Html.TexBoxFor(x => x.PropertyName)), we get value from route parameter instead of property of model. A: This is actually the correct behavior. MVC has a concept called ModelState (accessible via the Controller.ModelState property) which contains information about the model the MVC request is currently working with. The ModelState collection stores raw values submitted by the user and a list of validation errors for each of those values. For a complete example see http://forums.asp.net/p/1559541/3846809.aspx When displaying a form, all HTML helpers look in ModelState first to get the value that should be displayed to the user, then they look at the actual model itself if ModelState doesn’t contain anything useful. The reason for this is so that user input isn’t blasted away in the event of a conversion error. For example, say that the user types