I have the following courses…
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 got the “FirstName” of the label in all instances. The resource file is named Labels.resx, has an entry of “First”, and is located in the Properties folder.
Read a few After this article, I believe this should apply to .NET 4 (I am using VS2010 RTM and have targeted .NET 4).
Is this useful?
Thanks in advance
I am trying to save the model in an MVC 2 project using resource files
I have the following courses…
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 the label’s “FirstName” in all instances. The resource file name is Labels.resx, with the “First” entry, is located in the Properties folder.
After reading a few articles, I believe this should work for .NET 4 (I am using VS2010 RTM and have targeted. NET 4).
Is this useful?
Thanks in advance
http://weblogs.asp.net/rajbk/archive/2010/04/27/localization-in -asp-net-mvc-2-using-modelmetadata.aspx