I am using 开发者_C百科NavigateURL to dynamically pull in the url of products on a receipt page.
Here is the exact code:
<a class="blue13" href="<%#Eval("Product.NavigateUrl")%>"><%#Eval("Product.Name")%></a>
It is placing "/checkout/~/" in each of the url.
How can I remove or correct this?
Thanks!
The simplest thing would probably be to just call .Replace()
and replace the unwanted part with a empty string. But it depends relay. Why is it there to begin with? Where is the data coming from?
I ended up switching from a regular href to an asp:HyperLink and it corrected the /~/ issue.
So, before I was using
<a class="blue13" href="<%#Eval("Product.NavigateUrl")%>" runat="server"><%#Eval("Product.Name")%></a><br/>
And I switched it to:
<asp:HyperLink CssClass="blue13" runat="server" NavigateUrl='<%#Eval("Product.NavigateUrl")%>' Text='<%#Eval("Product.Name")%>'></asp:HyperLink>
Which correct the issue.
Thanks.
精彩评论