如何使用资源文件来设置按钮上的文字 [英] How to set button text using resource file
本文介绍了如何使用资源文件来设置按钮上的文字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经在测试项目但不App_GlobalResources.How下创建的资源文件可以利用我的资源文件中设置按钮上的文字。
对于例如:
I have created resource file under Test Project but not under App_GlobalResources.How can i set button text using resource file. For eg:
<asp:Button ID="btnTest" runat="server" Text="<%:TestProject.TestResource.Test%>" />
当我使用上述code我在得到按钮空白的文本。
When i use above code i am getting blank text in the button.
注意 - 我不想定在code behind.How文本,我可以在aspx文件实现这一
感谢您的帮助。
推荐答案
假设你Resourcesfile被称为:
Assuming your Resourcesfile is called:
/App_GlobalResources/TestResource.resx
和资源串测试
,这应该工作:
And the resource string Test
, this should work:
<asp:Button ID="btnTest" runat="server" Text="<%$ Resources: TestResource, Test %>" />
这篇关于如何使用资源文件来设置按钮上的文字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文