ValidationHelper method like Validation.IsValid("somefield") that is only checked on IsPost
I like to attach a CSS class to my field labels when a posted field value is invalid.
In my latest Web Pages project, I currently do that with ModelState.IsValidField("somefield") (as it is done in the Starter Site template projects) but it appears that there is an effort to move all those things to the WebPages.ValidationHelper. There is Validation.IsValid("somefield"), but that is checked regardless of whether a form was posted back. This makes all fields show up invalid on the GET request as well. It would be nice to be able to inject that CSS class with a method on Validation that also incorporates the current page's IsPost (or even crossed with whether Validate has been called directly, since Validation.IsValid("somefield") actually calls Validate("somefield") itself).
I put together a rather pathetic extension method to do this, pathetic because it requires passing in IsPost because the HttpContext used to create the ValidationHelper is held privately.
For now, you should use ModelState.IsValidField. If you look at the starter template in WebMatrix Beta, this is how it does it.
However, we are looking at adding something on the ValidationHelper to make your scenario simpler so keep voting this one up, everyone.
Thanks for the suggestion!