I\'m using MVC 2 for a project and I\'m having a problem with a view. In the controller I have the code:
return View(calendarDay);
If I deb
I suspect that you are trying to modify the POSTed value (which is 1) in your controller action to 2. This is not possible because that's how all HTML helpers work and it is by design: they will first look at the POSTed value when binding and after that in the model. So the HiddenFor
helper ignores the Id of your model and uses the one that's posted.
As a workaround you could:
As suggested by @jfar in the comments section another workaround is to clear the model state in the post action before returning the view:
MoselState.Clear();