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 7496577
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T18:40:50+00:00 2026-05-29T18:40:50+00:00

i have a MVC controller called MyController with an action called MyAction. For other

  • 0

i have a MVC controller called MyController with an action called MyAction. For other hand i have a Model called MyModel, and all this classes are in a project called Portal.Website (Asp.net MVC3 Application) that i use as a generic website and that store common functionalities for custom websites that i will add in the future.

For other hand i have another website project with a reference to Portal.Website project called Portal.Website.MyCustomWebsite.

This is the viewmodel MyModel.cs in the generic website part:

namespace Portal.Website
{
    public class MyModel
    {
        [Required(ErrorMessage="The field Name is required.")]
        [Display("MyPropertyOriginal")]
        public virtual string Name{get;set;}
    }
}

This is the controller and action in the generic website part:

namespace Portal.Website
{
    public class MyController: Controller
    {
       [HttpPost]
       public ActionResult MyAction(MyModel model)
       {
          if(Model.IsValid)
          ....
          //My issue: Im getting the error message in english, not the overridden one.

       }
    }
}

This is the viewmodel that i created in the custom part:

namespace Portal.Website.MyCustomWebsite
{
    public class MyModel: MyModel
    {
        [Required(ErrorMessage="My error message in other language.")]
        [Display("MyPropertyOverriden")]
        public override string Name{get;set;}
    }
}

My problem:

I would like to override the ErrorMessage of the Required attribute. For this reason i created a new Model in my custom project. For other hand i would like to use the Controller/Action (MyController/MyAction) that is already defined in my common part.

Do you know if this is possible? Im only getting the issue with the Required attribute, but with the Display one its working perfect.

Thanks in advance.
Greets.
Jose.

  • 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-29T18:40:51+00:00Added an answer on May 29, 2026 at 6:40 pm

    You may want to check out this article that suggests two possible solutions :

    http://www.codeproject.com/Articles/130586/Simplified-localization-for-DataAnnotations

    I’ve found it was making more sense to re-create some DataAnnotation classes with my custom logic.

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

Sidebar

Related Questions

If I have an ASP.NET MVC controller action that is called from a jQuery
I have a div called test and mvc action in the client controller The
I have an action like this: public class News : System.Web.Mvc.Controller { public ActionResult
I have inheritted some code in which the MVC Controller classes all get their
I have problem like link text All of my links look like this: htp//site/controller/action/id
I have an ASP.Net MVC Controller with a 'MapColumns' action along with a corresponding
I have the following route: {language}/{controller}.mvc/{action}/{id} Once a user has choosen the language it
I have a controller in MVC serving up images from a database. EDIT: This
ASP.Net MVC Controllers have several methods of forwarding control to another controller or action.
in my MVC application I have a controller (ProjectController) which has an action (create).

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.