Nate
Nate

Reputation: 837

mvc 4 localization

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.

enter image description here

enter image description here

What is wrong?

Upvotes: 1

Views: 2721

Answers (2)

Styxxy
Styxxy

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:

Change access modifier resource

Upvotes: 1

Sergey Gavruk
Sergey Gavruk

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

Related Questions