I have this code in my controller:
[HttpGet]
public ActionResult Register(UserRegistrationModel model)
{
return View();
}
The reason I do like this is because the Register page can be pre-populated with values from querystring that are generated from other pages.
The problem is that when my view gets rendered, it shows the validation errors… Is there a way to bypass it?
Normally when running an action such as this you would tend to use individual parameters rather than a complete model; what it looks like is happening is the model binder is kicking in and validating your model for you.
Can you verify by debugging the action that
ModelState.IsValidis false and that it has some keys in it relating to the fields on your model which are invalid? If so you could try to do aModelState.Clear()before you return the view to prevent the validation errors from showing up in this case.