Resource file in aspx page “Eval” syntax

喜欢而已 提交于 2019-12-12 00:21:33

问题


<asp:TemplateField>
    <ItemTemplate>
        <a id="btnShowPopup" runat="server" class="thickbox" title='<%# Eval("DB_TRAK_NO", "Details for Trak No.  {0}") %>>
            View
        </a>
    </ItemTemplate>
    <HeaderStyle VerticalAlign="Middle" />
</asp:TemplateField>

My Global resouce file name is Resource.resx and Resource.zh-CN.resx, key for "Details for Trak No" is "DetailsforTrakNo" in resource files. How can I push the Chinese characters when the culture is Chinese. I dont know the syntax to write title in anchor tag.. can you pls help me in this.

Regards, Abhi


回答1:


<a id="btnShowPopup" runat="server" class="thickbox" title='<%$ Resource:Resources, DetailsforTrakNo %>'>
    View
</a>



回答2:


You should try <%$ Resources:YourResourceTypeName, Key %> syntax to add global resource expression.

title='<%$ Resources:Resource, DetailsforTrakNo %>'



回答3:


you can also use

Text='<%#Eval(GetLocalResourceObject("gvstrCompanyName").ToString())%>'


来源:https://stackoverflow.com/questions/11626080/resource-file-in-aspx-page-eval-syntax

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!