I am trying to use a resource file to store label text for a model in an MVC 2 project.
I have the following class ...
public class Person
{
[Display(ResourceType = typeof(Resources.Labels),Name="First")]
public string FirstName { get; set; }
public string LastName { get; set; }
}
... and tried to use ...
<%: Html.EditorForModel() %>
<%: Html.EditorFor(m => m) %>
<%: Html.LabelFor(m => m.FirstName) %>
... but I get "FirstName" for the label in all instances. The resource file, called Labels.resx, has an entry for "First" and is located in the "Properties" folder.
After reading a few posts, I believe this should work in .NET 4 (I use VS2010 RTM and configured .NET 4).
If it works?
Thanks in advance
source
share