Reputation: 192
Im developed the MVC project , I want to style this display error message but its not working,i cant add this for CSS style ,How can i do it?
@Html.ValidationMessageFor(a => a.SelectedValue)
CSS
.field-validation-error {
color: #ff0000;
position: absolute;
left: 200px;
top: 5px; font-size:14px; font-family:'Arno Pro';
width: 250px; /*background:url(../img/wrng_icn.png) no-repeat right center;
}
Upvotes: 2
Views: 80
Reputation: 8183
You can assign custom attributes to Html Helpers like the below.
@Html.ValidationMessageFor(a => a.SelectedValue, new {@class = "field-validation-error"});
Update: Pass it a null to use a different overload
@Html.ValidationMessageFor(a => a.SelectedValue, null, new {@class = "field-validation-error"});
Upvotes: 4