开发者

How to remove portion of url when using NavigateURL

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜