views:

34

answers:

1

Hello All,

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?

A: 

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'/>";
Janis Veinbergs