1

I am trying to send an ASIN number into the querystring from a hyperlink and I'm having trouble getting the correct syntax. Any ideas?

<asp:HyperLink ID="hlProductPage" Enabled="true" runat="server" NavigateUrl="ProductPage.aspx?ASIN=<%# Eval("ASIN")%>">Read More...</asp:HyperLink>

Thanks so much!

3 Answers 3

7
NavigateUrl='<%# Eval("ASIN", "ProductPage.aspx?ASIN={0}")%>'

When you use <% %> in attributes of server/user controls <% must appear just after the opening quote and %> must appear just before the closing quote. In other words, you cannot have both code and static content. Also, use single quotes, that way you can use double quotes for strings without confusing the parser.

Sign up to request clarification or add additional context in comments.

Comments

1

try

NavigateUrl='ProductPage.aspx?ASIN=<%# Eval("ASIN")%>'>

notice the single quotes

Comments

-1

You'll need to set the NavigateURL property in the code behind.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.