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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:37:40+00:00 2026-06-04T16:37:40+00:00

string thing = ComparaSave.Resources.Message.EmailAdrRequired; [Required(ErrorMessage = thing)] <—- The problem!! [DataType(DataType.EmailAddress)] [Display(Name = Email

  • 0
string thing = ComparaSave.Resources.Message.EmailAdrRequired;
[Required(ErrorMessage = thing)]    <---- The problem!!
[DataType(DataType.EmailAddress)]
[Display(Name = "Email Address")]
[StringLength(100)]
[EmailAddress]
public string Email { get; set; }

Throws the error:

An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type.

How can I read a resource file into an attribute such as this?

  • 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-06-04T16:37:41+00:00Added an answer on June 4, 2026 at 4:37 pm

    You need to use :

    [Required(ErrorMessageResourceName= "FullNameRequired", ErrorMessageResourceType = typeof(MyResource)]
    

    ErrorMessage is for string only.

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

Sidebar

Related Questions

I've scaffolded Things element: script/generate scaffold wip/thing name:string and got some invalid function call
Here's the code: string name = myName; int id = (int)_myDB.ThingTable.Where(thing => thing.ThingName ==
I have a string some thing like my+*%name===is+jhon!#and&*^I$stay===in^&$#@US . I want output as s[0]=my
I am encoding PDU message. At beggining of message I got String Some thing
Given this code: List<string> things = new List<string>(); foreach (string thing in things) {
Say I create some object class like so public class thing { private String
I'm tring to use the NSURL class's parameterString message to return the string from
Imagine I have this string: string thing = sergio|tapia|gutierrez|21|Boston; In C# I could go:
Does anyone know if something like this is possible in Scala: case class Thing(property:String)
On the one hand; String first = thing; String second = thing; if(first ==

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.