I have project asp.net with namespace test and I’m using resources (files Resource.resx and Resource.en-GB.resx). I have in resources key MY_TEXT with value. In file .aspx I can use
<%# Resources.Resource.MY_TEXT %>
but when I’m using (like in article http://msdn.microsoft.com/en-us/magazine/cc163566.aspx)
myLabel.Text = Resource.MYTEXT;
It don’t found it and I have build error. Why?
Best regards,
Dagna
Try something like this:
Let me know if it works or what kind of error the compiler gives you.
You can also write it as you wrote in your question, click on
Resourcesto put cursor there, hit Ctrl + . and select a namespace to be added. This should make Visual Studio detect a validResourcenamespace (or suggest few available namespaces) automatically.Update
This article explains how to use resources in code behind:
http://msdn.microsoft.com/en-us/library/ms227982%28v=vs.85%29.aspx. I mentioned it in comments and it helped you, so I’m adding it as a part of an answer.