Resource file in aspx page “Eval” syntax

2019-08-31 04:25发布

问题:

<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())%>'