Reputation: 3936
I have something like this
<%using (Html.BeginForm("X", "Y", FormMethod.Post, new { id="Z" })) { %>
<table align="center" style="width:70%;margin-bottom:15px;" cellspacing="5px";>
<tr>
<td width="40%">Nr.:</td>
<td width="60%"><%=Html.TextBox("Nr", Model.Nr, new { width = 130, maxlength = 10 })%></td>
</tr>
..............
Nr property is double (no attributes on it) so it is 0.0 when new Model object or a doble when i edit. When i edit i get the value in it(no class on it) when i add instead of 0.0 i see "null" in it and with that class on it (i removed all js from the Scripts folder i only have jquery and jquery vsdoc) This is the only field i get that class on and i can't figure it why. I don't have any other control with that id on the page. Help please!
Upvotes: 1
Views: 3078
Reputation: 10753
The input-validation-error
class is generated by the built-in MVC validation. I think this class' CSS is in /Content/Site.css
when using the MVC Web Application template. Scroll down to the section that looks like this:
/* Styles for validation helpers
-----------------------------------------------------------*/
.field-validation-error
{
color: #ff0000;
}
.field-validation-valid
{
display: none;
}
.input-validation-error
{
border: 1px solid #ff0000;
background-color: #ffeeee;
}
After an invalid model posts, the invalid fields will have this style by default--a red border with a light red background.
Upvotes: 2