Reputation: 185
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?
Upvotes: 0
Views: 3437
Reputation: 6988
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'/>";
Upvotes: 1