Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a user control, and I would like to use there the OOTB resource files for some standard text.

So I found a resource file WSS and there a resource to view.

In code:

<asp:literal runat="server" id="literal1" text="<%$Resources:wss,view_selector_view;%>" /> 

But it just shows this <%$Resources:wss,view_selector_view;%> and not the resource value.

Any idea what i'm doing wrong?

Update: Had error which said that key could not be found: solved it by removing ";" as it was not needed.

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

You need to escape the Resources tag, like this:

<asp:literal runat="server" id="literal1" text="&lt;%$Resources:wss,view_selector_view;%&gt;" /> 

Ugly, but the only way unfortunately.

share|improve this answer
    
oh really, is it only for literal? or for all controls? –  Shkipper Aug 5 '12 at 21:09
    
I'm not entirely certain, Literal does what it says, so I'm not sure what, say, asp:Label would do if you put a resources tag in. Give it a go. –  James Love Aug 5 '12 at 21:24
    
a is it possible to just call resource just as text? without any literal or any other controls? just in html: "&lt;%$Resources:wss,view_selector_view;%&gt; –  Shkipper Aug 6 '12 at 5:58
    
and a problem now is, is that it doesnt show anything at all :( –  Shkipper Aug 6 '12 at 6:00
    
following error: The resource object with key 'view_selector_view;' was not found. –  Shkipper Aug 6 '12 at 6:53
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.