ASP:LinkButton and Eval
Posted
by sgibbons
on Stack Overflow
See other posts from Stack Overflow
or by sgibbons
Published on 2009-02-23T19:16:32Z
Indexed on
2010/05/09
5:18 UTC
Read the original article
Hit count: 332
I'm using an ASP:LinkButton inside of an ItemTemplate inside of a TemplateField in a GridView. For the command argument for the link button I want to pass the ID of the row from the datasource that the gridview is bound to, so I'm doing something like this:
<asp:LinkButton ID="viewLogButton" CommandName="viewLog" CommandArgument="<%#Eval("ID")%>" Text="View Log" runat="server"/>
Unfortunately, the resulting HTML is this:
<asp:LinkButton ID="viewLogButton" CommandName="viewLog" CommandArgument="3" Text="View Log" runat="server"/>
It seems that it is parsing the Eval() properly, but this is somehow causing it not to parse the LinkButton tag and just dump it out as literal text. Does anyone know:
a) why this is happening and, b) what a good solution to this problem is?
© Stack Overflow or respective owner