Scenario
Route: /template/customize/10
Where: 10 = ID of Template()
In the controller the model is created based on the template so that the Vie
To prevent route values from overriding the model's corresponding properties, call ModelState.Clear() in your controller action. Be careful to call this method after using/reading the model state.
public ActionResult Customize( int id )
{
var template = Persistence.Data.RetrieveObject( id );
var model = new Customization();
ViewBag.Template = template;
this.ViewData.ModelState.Clear(); // add that after you consume the ModelState
return ( View( model ) );
}
On my side, the hidden input gets the model's value instead of the route value.