[英]Set the Resource String in javascript
How can I set the resource string in javascript?如何在 javascript 中设置资源字符串?
I have a resource file called, for example,我有一个资源文件,例如,
myResourceFile.resx
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%>" />
but if I try this in javascript, like:但是如果我在 javascript 中尝试这个,比如:
<asp:Button ID="btnImportCompaniesAndEmployees"
runat="server"
CssClass="myButtonCssClass"
OnClick="btnImportCompaniesAndEmployees_Click"
OnClientClick="strLoadingText='<%$ Resources:myResourceFile, ajaxRetrievingInformation%>';return true;"
...
/>
or或者
<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);
Thanks谢谢
You should be able to use:您应该能够使用:
<script type="text/javascript">
var strLoadingText = "<%= Resources.myResourceFile.ajaxRetrievingInformation %>";
</script>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.