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

前端 未结 3 1035
青春惊慌失措
青春惊慌失措 2021-02-07 03:31

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 o

3条回答
  •  没有蜡笔的小新
    2021-02-07 04:16

    you need to refer to your namespace:

    @GeneralResxNamespace.General.Hello
    

    You can do this in an easier way by adding namespace to /Views/Web.config file In section with namespaces add section below:

    
    

    Then you can use resources without namespace, like in the example:

    General.Hello
    

提交回复
热议问题