+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / List Item URL's being truncated when they contain an apostrophe

List Item URL's being truncated when they contain an apostrophe

3 posts, 1 answered
  1. Patricia
    Patricia avatar
    15 posts
    Registered:
    05 Jun 2015
    19 May
    Link to this post

    Since I like the expand/collapse feature, I am currently using an Expandable List template to show off my list. Due to my requirement's, I found a way for each list item to be seen in a new page by having a hyperlink based off of this: '<%# Eval("UrlName")%>'. 

    I got it to work based on the requirements needed, however I figured out that when my list item title has an apostrophe, the url name gets truncated and so I end up getting a broken link. 

    This post gave me insight on what's wrong which is that I need runat="server" in my template to work. 

    http://www.sitefinity.com/developer-network/forums/bugs-issues-/search-result-url's-are-being-truncated-when-they-contain-an-apostrophe 

    However, when I do that by doing an <asp hyperlink> instead of <a href> I get this error: A potentially dangerous Request.Path value was detected from the client (<).

    Adding this to the template gives me the right link, however I don't like that I can't change the page where it goes to nor change the text, it simply has the title as the text. 

    <sf:DetailsViewHyperLink runat="server" id="detailLink" TextDataField="Title" ToolTipDataField="Description" data-sf-field="Title" data-sf-ftype="ShortText"></sf:DetailsViewHyperLink>

    Does anyone know a way around this? Basically, I still would like to use the expandable list template for list items, but still have a way to access the individual list item in a separate page via a modifiable text that's a hyperlink. 

  2. Patricia
    Patricia avatar
    15 posts
    Registered:
    05 Jun 2015
    19 May
    Link to this post

    I found a way to change the text if I use the <sf:DetailsViewHyperLink> but would it be possible to redirect it to a different page instead of generating a new page with the url of the page I'm on?

    For example I have the expandable template w/ the hyperlink in a page with the url home/education. When I click the link, I get home/education/course-name , could I change it to redirect to home/main/course-name? Would this be possible?

  3. Svetoslav Manchev
    Svetoslav Manchev avatar
    735 posts
    Registered:
    07 Dec 2016
    24 May
    Link to this post
    Hi Patricia,

    You ca try using the HyperLink in your template, for example:
    <asp:HyperLink href='<%# String.Format("{0}{1}","home/education/", Eval("UrlName")) %>' Target="_blank" runat="server">Full Story</asp:HyperLink>

    This also seems work fine using (') in the Item's title.

    Regards,
    Svetoslav Manchev
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
    Answered
3 posts, 1 answered