Asp.net ReadOnly="<;%#绑定(";ServerProp";)%>&引用;语法错误

Asp.net ReadOnly="<;%#绑定(";ServerProp";)%>&引用;语法错误,asp.net,Asp.net,我正在尝试将bool从服务器绑定到标记: <asp:BoundField DataField="RevSharePercent" HeaderText="Revenue Share Percentage" SortExpression="RevSharePrecentage" ReadOnly="<%=SetFieldsReadOnly%>" /> 但是渲染显示以下错误: Parser Error Message: Literal content ('<a

我正在尝试将bool从服务器绑定到标记:

<asp:BoundField DataField="RevSharePercent" HeaderText="Revenue Share Percentage"
  SortExpression="RevSharePrecentage" ReadOnly="<%=SetFieldsReadOnly%>" />

但是渲染显示以下错误:

Parser Error Message: Literal content ('<asp:BoundField
DataField="RevSharePercent" HeaderText="Revenue Share Percentage"
SortExpression="RevSharePrecentage" ReadOnly="') is not allowed within a
'System.Web.UI.WebControls.DataControlFieldCollection'.

Source Error: 
Line 59:<AlternatingRowStyle BackColor="#E8E8E8" /> 
Line 60:    <Fields> 
Line 61:      <asp:BoundField DataField="RevSharePercent" HeaderText="Revenue Share Percentage" 
Line 62:        SortExpression="RevSharePrecentage" ReadOnly="<%# Bind("SetFieldsReadOnly") %>" /> 
Line 63:      <asp:BoundField DataField="ScreeningPercent" HeaderText="Screening Percentage" 
                SortExpression="ScreeningPercent" ReadOnly="<%# Bind("SetFieldsReadOnly") %>" />
解析器错误消息:文本内容('


我认为您需要尝试:

'<%# Bind("SetFieldsReadOnly") %>'
“”

“”
而不是

<%=SetFieldsReadOnly%>

注意Bind/Eval

刚刚在另一个网站上找到了有关语法的信息

在ASP.NET 1.1中,数据绑定标记为:

<%# DataBinder.Eval(Container.DataItem, ''expression'' ) %>
<%# DataBinder.Eval( '', '', ''format string'') %>

ASP.NET 2.0提供了这些功能以及以下功能:

<%# Eval(''expression'') %>
<%# Eval(''expression'', ''format string'') %>
<%# Bind(''expression'') %>
<%# Bind(''expression'', ''format string'') %>

我认为您需要尝试:

'<%# Bind("SetFieldsReadOnly") %>'
“”

“”
而不是

<%=SetFieldsReadOnly%>

注意Bind/Eval

刚刚在另一个网站上找到了有关语法的信息

在ASP.NET 1.1中,数据绑定标记为:

<%# DataBinder.Eval(Container.DataItem, ''expression'' ) %>
<%# DataBinder.Eval( '', '', ''format string'') %>

ASP.NET 2.0提供了这些功能以及以下功能:

<%# Eval(''expression'') %>
<%# Eval(''expression'', ''format string'') %>
<%# Bind(''expression'') %>
<%# Bind(''expression'', ''format string'') %>


双引号是罪魁祸首。aspx解析器认为
ReadOnly=“双引号是罪魁祸首。aspx解析器认为
ReadOnly=ServerPro应该是
bool
string
?ServerPro应该是
bool
string
?在#和Bind/Eval之间有空格吗?在#和Bind/Eval之间有空格吗?