ASP.Net LinkButton CommandArgument property ignores <%= .. %>
I'm trying to do what I thought was a very simple operation to set a property on an ASP.Net LinkButton control but for some reason ASP.Net is ignoring the tags and just passing through the value as a string. <asp:LinkButton id="viewDetails" runat="server" Text="Details" OnClick="btnDetails_Click" CommandName="ItemID" CommandArgument="<%= item.ItemID %>" /> When the link is clicked I handle it with: protected void btnDetails_Click(object sender, EventArgs e) { try { LinkButton btn = (LinkButton)sender; if (btn.CommandName == "ItemID") { string itemID = btn.CommandArgument.ToString(); } } catch