我试图找出如何将除静态字符串以外的内容放入text
的{{1}}属性中。以下代码:
<asp:button>
返回
分析程序错误消息:服务器标记不能包含&lt;%...%&gt;构建体。
答案 0 :(得分:0)
您需要<%# %>
的数据绑定表达式:
<asp:Button runat="server" ID="updateList" Text='<%# isEditing ? Resources.Labels.Update : Resources.Labels.Insert %>' />
但要让它在GridView,Repeater等之外工作,你必须手动调用DataBind()
。
protected void Page_Load(object sender, EventArgs e)
{
DataBind();
}