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

Posted by Community Admin on 03-Aug-2018 05:22

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

All Replies

Posted by Community Admin on 19-May-2016 00:00

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. 

www.sitefinity.com/.../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. 

Posted by Community Admin on 19-May-2016 00:00

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?

Posted by Community Admin on 24-May-2016 00:00

Hi Patricia,

You ca try using the HyperLink in your template, for example:

<asp:HyperLink href='<%# String.Format("01","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
 

This thread is closed