Stewie Griffin
Stewie Griffin

Reputation: 9327

Server tag is not well formed

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?

Upvotes: 4

Views: 4897

Answers (5)

karthik
karthik

Reputation: 341

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

Upvotes: 2

hungryMind
hungryMind

Reputation: 7009

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

Upvotes: 2

Dylan Meador
Dylan Meador

Reputation: 2401

It should look like this, with single quotes:

<asp:LinkButton ID="someID" CommandArgument='<%# Eval("ID") %>' 
    OnClick="someEvent_Click" runat="server">some text</asp:LinkButton>

Upvotes: 19

Ashley John
Ashley John

Reputation: 2453

put the ID inside Eval in single quotes

Upvotes: 0

m.edmondson
m.edmondson

Reputation: 30922

 <asp:LinkButton ID="someID" CommandArgument="<%# Eval('ID') %>" OnClick="someEvent_Click" runat="server">some text</asp:LinkButton>

Use single a single apostrophe.

Upvotes: 3

Related Questions