Reputation: 277
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.
Upvotes: 0
Views: 2726
Reputation: 63966
You can do what you want as follows:
<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>"%>'/>
Note how the <a>
is constructed in there... OtherPage.aspx
would be your link to whatever other page you need to send the user to.
Upvotes: 2
Reputation: 122
Ok, revising, have you done this?
<asp:Label ...><Asp:HyperLink ...>More...</HyperLink> </Label>
Upvotes: 0