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

  • SEARCH
  • Home
  • 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 7688287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:53:07+00:00 2026-05-31T19:53:07+00:00

In ASP.NET MVC3 I’m trying to set the css class that the validation error

  • 0

In ASP.NET MVC3 I’m trying to set the css class that the validation error helper method sets. (Not this question, the accepted answer just ADDS the class, I want to override it completely.) In looking at the MVC3 source I’ve found the ValidationInputCssClassName property on the HtmlHelper class. It is settable and it stores the value in a storage provider if set. The get method for the property returns [the provider value] ?? [the default class name].

Now if you just type in HtmlHelper.ValidationInputCssClassName (MSDN entry) in your controller code you’ll see that it is a static readonly field. The reason for this is that there are two HtmlHelper classes, one is in the System.Web.Mvc namespace, and the other is in the System.Web.Webpages.Html namespace. The property System.Web.Webpages.Html.HtmlHelper.ValidationInputCssClassName (MSDN entry) can be set, but it doesn’t seem to have any effect the generated code no matter where I set it.

What am I missing? And what is the difference between these classes?

  • 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-31T19:53:09+00:00Added an answer on May 31, 2026 at 7:53 pm

    I’m not positive but I think System.Web.WebPages.Html is for using ASP.net WebForms with Razor.

    Since ValidationInputCssClassName, etc. are all readonly fields, I think the only way you are going to get around this is by creating your own HtmlHelper extension methods so you can customize this behavior.

    From MSDN:

    The System.Web.WebPages namespace contains core classes that are used
    to render and execute pages that are built using ASP.NET Web Pages
    with the Razor syntax.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using ASP.NET MVC3 with razor engine.I want to apply css class on body
I have an ASP.NET MVC3 project that uses a tab strip on certain pages.
Assume we have an ASP.NET MVC3 Web site that makes use of Entity Framework
ASP.NET MVC3 newb here. I am working on a MVC3 intranet application that uses
In ASP.NET MVC3 application, my controllers will work with the set of BL manager
With ASP.NET MVC3 (Razor) I have a simple page that loads a jQuery UI
I have an ASP.NET MVC3 app that features a form with a nested-table input
I am new to asp.net mvc3 and trying to get a connection going to
Context: Asp.Net MVC3 w/Razor I am trying to put a login form on a
The server is hosting Asp.net mvc3 app and the Browser culture is set to

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.