0

I am developing a user control for SharePoint in Visual Studio 2005. I make core usage of javascript in my ascx. Also, I have an aspx page in my project which defines the settings for the user control.

I want to access all the text from resx file using Javascript in the ascx and also in the aspx page. I am trying to place a common resx file (which contains the text of both the aspx and ascx) under the 12 hive since it could be accessible from any site. Any insights of how to achieve this?

1 Answer 1

1

You may try

<script type="text/javascript">
    var code = "<%$Resources:myresource,myScript%>";
    eval(code);
</script>

If you just want to retrieve a localized string to be set by javascript, you may better use

var localizedStr = "<SharePoint:EncodedLiteral runat='server' text='<%$Resources:wss,form_ok%>' EncodeMethod='EcmaScriptStringLiteralEncode'/>";
Sign up to request clarification or add additional context in comments.

Comments

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.