Reputation: 837
I'm trying to use localization in my project. I created MVC 4 project and added resourses.resx file. But when i try to access this file from _Layout.schtml studio say that name 'Resources' doesn't exist in current context.
What is wrong?
Upvotes: 1
Views: 2721
Reputation: 7517
You have to add the namespace of your resources in an @using
statement in the beginning of the page (the _Layout.cshtml
file), or either add the namespace to the beginning.
In your case, add @using kazwaySite
and it should work. Also, be aware that the access modifier of your Resource, is set to public
. Open your resource file, and you'll see this this (see below) on the top your screen:
Upvotes: 1
Reputation: 3558
Use @Resources.ResourceName.Property
when you want to access your resource from cshtml
Don't forget to make your resource Public access
Upvotes: 1