0

I am trying to add a link inside a label in a ListView item template but I can't make it work.

I have this label:

<asp:Label runat="server" ID="SummaryLabel" Text='<%# Eval("Summary").ToString().Substring(0,Math.Min(200,Eval("Summary").ToString().Length)) + "... " + "More"%>'/>

and I want the word More at the end to be a link to the details page of the item. Tried putting "More" inside an anchor tag and hyperlink but I get badly formed tags. I'd appreciate any help to solving this or suggestions on alternative approaches.

4

2 回答 2

2

你可以做你想做的事,如下所示:

<asp:Label runat="server" ID="SummaryLabel" Text='<%# Eval("Summary").ToString().Substring(0,Math.Min(200,Eval("Summary").ToString().Length)) + "... " + @"<a href=""Oherpage.aspx"">More</a>"%>'/>

请注意<a>那里的构造方式......OtherPage.aspx将是您需要将用户发送到的任何其他页面的链接。

于 2013-07-29T16:06:04.287 回答
0

好的,修改,你做到了吗?

   <asp:Label ...><Asp:HyperLink ...>More...</HyperLink> </Label>
于 2013-07-29T15:35:36.343 回答