Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

TryValidateModel and TryUpdateModel don't revalidate the model if model is already validated after model binding #2071

Closed
kirthik opened this issue Feb 24, 2015 · 1 comment
Assignees
Milestone

Comments

@kirthik
Copy link
Contributor

kirthik commented Feb 24, 2015

If I have an action

public object UpdateModel(Product product)
{
   product.Name = null;
   TryValidateModel(product)
 }

TryValidateModel(product) does not re-validate model since it is already validated after model binding.

We should clear model state errors and change the ValidationState to Unvalidated in ModelStateDictionary for TryValidateModel and TryUpdateModel

@kirthik
Copy link
Contributor Author

kirthik commented Mar 11, 2015

Fix checked in - 7b18d1d

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants