Created
November 3, 2011 22:20
-
-
Save jeffhandley/1338049 to your computer and use it in GitHub Desktop.
Help name this
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- What you can do today --> | |
<label for="firstname" class="@(ModelState.IsValidField("firstname") ? "" : "invalid")">First Name</label> | |
<!-- A proposed helper method that needs a name --> | |
<label for="firstname" class="@Validation.InvalidClass("firstname", "invalid")">First Name</label> | |
<!-- With a property that defines the invalid class name, which could be defaulted to "invalid" --> | |
@{ Validation.InvalidClassName = "invalid"; } | |
<label for="firstname" class="@Validation.InvalidClass("firstname")">First Name</label> |
Yeah. Although, I suggest :)
ctor() {
ClassForValidFields = string.Empty;
ClassForInvalidFields = "invalid";
}
public string ClassForValidFields { get; set; }
public string ClassForInvalidFields { get; set; }
Thanks guys!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ClassFor seems good. With properties:
private string _classForInalidFields = "invalid";
public string ClassForInvalidFields { get { return _classForInvalidFields; } set { _classForInvalidFields = value; } }
private string _classForValidFields = String.Empty;
public string ClassForValidFields { get { return _classForValidFields; } set { _classForValidFields = value; } }