如何设置JavaScript中的资源字符串?
How can I set the resource string in javascript?
我有一个称为资源文件,例如,
I have a resource file called, for example,
myResourceFile.resx
在我的code和使用文字的控制,我可以使用:
in my code and using the literal control I can use:
lblName.Text = Resources.myResourceFile.ajaxRetrievingInformation;
<asp:Literal id="lit" runat="server"
Text="<%$ Resources:myResourceFile, ajaxRetrievingInformation%>" />
但如果我尝试这在JavaScript中,这样的:
but if I try this in javascript, like:
<asp:Button ID="btnImportCompaniesAndEmployees"
runat="server"
CssClass="myButtonCssClass"
OnClick="btnImportCompaniesAndEmployees_Click"
OnClientClick="strLoadingText='<%$ Resources:myResourceFile, ajaxRetrievingInformation%>';return true;"
...
/>
或
<script type="text/javascript">
var strLoadingText = '<%$ Resources:myResourceFile, ajaxRetrievingInformation%>';
</script>
我得到的错误...
I get errors...
有谁知道如何管理呢? 类似于
Does anyone know how to manage this? Something like:
var strLoadingText = Resources.GetString(myResourceFile, ajaxRetrievingInformation);
感谢
您应该能够使用:
<script type="text/javascript">
var strLoadingText = "<%= Resources.myResourceFile.ajaxRetrievingInformation %>";
</script>
上一篇:转换WMI的Win32_OperatingSystem InstallDate以MM / DD / yyyy格式(C# - WPF)格式、InstallDate、Win32_OperatingSys