I get this message on this line below:
<asp:LinkButton ID="someID" CommandArgument="<%# Eval("ID") %>"
OnClick="someEvent_Click"
runat="server">some text</asp:LinkButton>
It does not like, that I put Eval
into CommandArgument
. What's wrong here?
It should look like this, with single quotes:
<asp:LinkButton ID="someID" CommandArgument='<%# Eval("ID") %>'
OnClick="someEvent_Click" runat="server">some text</asp:LinkButton>
<asp:LinkButton ID="someID" CommandArgument="<%# Eval('ID') %>" OnClick="someEvent_Click" runat="server">some text</asp:LinkButton>
使用单个撇号。
"<%# Eval("ID") %>"
is the culprit. Eventully its only CommandArgument="<%# Eval("
rest makes syntax error. Try pair of double quotes to pair of single quote. Like this CommandArgument='<%# Eval("ID") %>'
尝试使用CommandArgument='<%# Eval("ID") %>'
而不是(")
。
将ID
放在Eval
单引号
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.