Reputation: 2904
I'd like to use resource file (.resx) to do localization in ASP.NET MVC. My thought is:
then, I'd like to use resource file in controller to set ViewData value, something like:
ViewData["Title"] = Resources:Resource, PageTitle;
but the syntax is wrong, how can I do this?
Any idea?
Upvotes: 1
Views: 1212
Reputation: 35787
Did you tried following?
ViewData["Title"] = Resources.Resource.PageTitle;
If you have Resource.aspx
file in your App_GlobalResources
this should work.
Upvotes: 1