Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6850615
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:08:47+00:00 2026-05-27T01:08:47+00:00

This works fine: @Html.ValidationMessageFor(m => m.Definition) except for the fact that the text comes

  • 0

This works fine:

@Html.ValidationMessageFor(m => m.Definition)

except for the fact that the text comes out black. I want it in red. So, I tried this:

@Html.ValidationMessageFor(m => m.Definition, null, new { style = "color: red" })

However, that is setting the message to NULL. It’s crazy that there is no overload that will take the htmlAttributes arg without the message arg….. argghhh!!!

What’s the most elegant way to accomplish this (without me having to write my own validation messages)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T01:08:48+00:00Added an answer on May 27, 2026 at 1:08 am

    Found the answer here: http://www.jstawski.com/archive/2011/05/12/asp.net-mvc3-change-validation-class.aspx

    EDIT

    Answer now here: http://jstawski.com/post/2011/05/13/ASPNET-MVC3-change-validation-class

    Basically:

    If you are using the ASP.net MVC3 built in validation such as

    @Html.ValidationMessageFor(m => m.Username)
    

    you can easily change the validation by overriding the CSS class field-validation-error like this:

    .field-validation-error
    {
        color: red;
    }
    
    .validation-summary-errors
    {
        color: Red;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created a Tooltip with a HTML formated text, this works fine, but I
I load some html using AJAX, this works fine, one of the bits that
This works fine: GET /mvc/Movies/TitleIncludes/Lara%20Croft When I submit a request that contains a colon,
I'm trying to parse HTML file with libxml2. Usually this works fine, but not
I have a tag definition for mytag in a mytag.py file. This works fine
RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^alice.html$ bob.html This works fine.
I'm trying to run headless tests from Jenkins. This works fine for HTML tests
I have $('#structure').html(html); This works fine in FireFox. IE 8 doesn't display the html.
So this works fine, as you all know $(#foo).html = bar; But how would
This works fine: $.getJSON(http://localhost:59396/xxxWeb/ CarouselHandler.ashx?action=getproducts&ids= + ids, function(data) { carousel.size(allProductIDs.length); if (numberOfImagesLeftToShow < numberOfImagesToDisplay)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.