Reputation: 331
I am trying to pass a parameter from a page to another. I am getting parsing errors (Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. )
This is the code :
<a runat="server" href="~/ProductDetails.aspx?IDProduct=<%# Eval("IDProduct") %>">
<asp:Label Font-Size="16px" ForeColor="Red" runat="server">get specifications</asp:Label>
</a>
I am getting errors at IDProduct=<%# Eval("IDProduct") %>!
How should i write it ?
Upvotes: 1
Views: 124
Reputation: 56726
The proper way to handle such cases is to make the whole attribute value generated inside <%# %>
. Also note the updated quoting pattern - single quotes around attribute value, and double quotes inside <%# %>
.
href='<%# "~/ProductDetails.aspx?IDProduct=" + Eval("IDProduct") %>'
Upvotes: 3
Reputation: 45
Try to do this
<a runat="server" href="~/ProductDetails.aspx?IDProduct="<%# Eval("IDProduct") %>>
Upvotes: 0