开发者

Server tag is not well formed

开发者 https://www.devze.com 2023-03-30 22:43 出处:网络
I get this message on this line below: <asp:LinkButton ID=\"someID\" CommandArgument=\"<%# Eval(\"ID\") %>\"

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>

Use single a single apostrophe.


"<%# 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") %>'


try with CommandArgument='<%# Eval("ID") %>' instead of (").


put the ID inside Eval in single quotes

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号