从资源列表项Asp.Net绑定字符串 [英] Asp.Net bind string from resources to ListItem
本文介绍了从资源列表项Asp.Net绑定字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下code。
<asp:DropDownList ID="CurrencyList" AutoPostBack="true" runat="server" OnSelectedIndexChanged="CurrencyList_SelectedIndexChanged">
<asp:ListItem Text="<%$ GetGlobalResourceObject("GlobalResourceBms", "RentPage2FilterByLabel")%>" Value="-1"></asp:ListItem>
</asp:DropDownList>
这code抛出
分析器错误信息:文字前pressions像'&LT;%$ GetGlobalResourceObject(GlobalResourceBms,RentPage2FilterByLabel)%>是不允许的。使用/>代替。
Parser Error Message: Literal expressions like '<%$ GetGlobalResourceObject("GlobalResourceBms", "RentPage2FilterByLabel")%>' are not allowed. Use " /> instead.
如何这个东西Asp.NET,我需要从资源获取字符串,并把它作为下拉菜单项目
How to this thing in Asp.NET , I need to get string from resources and put it as Item of dropdown
推荐答案
尝试使用
<%# GetGlobalResourceObject("GlobalResourceBms","RentPage2FilterByLabel" ) %>
修改
您将需要以不同的方式添加的项目。
You will need to add the items in a different way.
填充您的DDL,使用的RowDataBound方法。你看:
Populate your ddl, using the rowdatabound method. Look:
public void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow) {
DropDownList ddl = (DropDownList)e.Row.FindControl("CurrencyList");
//items.
}
}
这篇关于从资源列表项Asp.Net绑定字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文