How to access global resources in a view using asp.net mvc razor

FiveTools picture FiveTools · Jul 9, 2012 · Viewed 40.6k times · Source

Using ASP.NET MVC Razor, I have a resource file in App_GlobalResources named General.resx and General.fr.resx with a name value pairings of "Hello" and "Hello" and "Hello" and "Bonjour".

How do I reference these from my view?

These do not work:

@Html.Resource("General.Hello")
@Html.Resource("GlobalResources.Hello")
@Html.Resource("GlobalResources.General.Hello")
@Html.Resource("GlobalResources, General.Hello") 

Answer

VJAI picture VJAI · Jul 9, 2012

Try this,

@Resources.General.Hello

syntax: Resources.[ResourceName].[Property]