Search code examples
asp.net-mvcresourcesasp.net-mvc-viewsmetatag

how to save text in app_resource. asp net mvc c# metatags


I have all my text inside view coding. I preffer to save it in app_resources, because i would to add other languages in future, and its look quite cleaner.

I just know that I need to use metatags in my view for text to connect it with file app_resource. How to it correctly, could you show me some examples how it looks like in view??

Thanks a lot and take care, Ragims


Solution

  • You only need to create App_LocalResources folder in the same folder where you hold your views. Then give a name to zzz.resx. And then you can call resources in your view via zzz.

    Example: *You have folder Contact in your View Folder. Your add App_LocalResources to Contact folder. Then you give a name Contact.resx to your .resx file.

    Finally in the view you can use <%= ContactResources.Contact.Index_ContactWithUs %> where Contact.Index_ContactWithUs - name of concrete resource.

    Don't forget that in resources settings you can modify access type (Internal or Public).