1

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.

1 Answer 1

1

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.

5
  • oh really, is it only for literal? or for all controls? Commented Aug 5, 2012 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. Commented Aug 5, 2012 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; Commented Aug 6, 2012 at 5:58
  • and a problem now is, is that it doesnt show anything at all :( Commented Aug 6, 2012 at 6:00
  • following error: The resource object with key 'view_selector_view;' was not found. Commented Aug 6, 2012 at 6:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.