Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get DisplayName from resource file [duplicate]

I have culture specific resource files in App_GlobalResources folder. Now I need to read value of the DisplayName attribute from this resource files. I am using:

[Display(Name = "MerchantName", ResourceType = typeof(Resource))]
public string Merchant { get; set; }

but I am getting the following error:

Cannot retrieve property 'Name' because localization failed. Type 'Resources.Resource' is not public or does not contain a public static string property with the name 'MerchantName'.

How do I solve this problem?

like image 801
Achinth Gurkhi Avatar asked May 20 '11 07:05

Achinth Gurkhi


1 Answers

In my case I had to change the Access modifier of my resource from Internal to Public.

Public_vs_Internal

By default all Resources are created as Internal.

like image 118
michal Avatar answered Oct 14 '22 01:10

michal