I am using ASP.NET tags in my markup an ASCX file.
<a id="MyId" runat="server" href="page.aspx?id=<%= Item.Id %>">View Item</a>
Item is a property in my control class in code behind.
However, the markup above is being rendered to the HTML unchanged, include the <%= %> characters.
Does anyone have any idea why this might be?
Try removing the
runat="server"attribute from the anchor, like so:or use a HyperLink:
and in the code behind set the value:
or using data binding syntax:
and in the code behind call: