Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Problems with ÅÄÖ in URL in linklist

Vote:
 

Hi!

Some sites to day have åäö in their url. Like this site: http://www.tänkom.nu/

If an editor makes a link to that site using the standard XHTML property everything is fine on our site. But we also have a linklist and when an editor makes a link in that it doesnt work so well. Here is an example, click on the two links (main body and right column):
http://www.nykoping.se/Om-webbplatsen/Webbkarta/Lank-till-Tank-om/



The linklist seems to be a property with code behind to it. The Property's name is "RelatedInfo". This is some if the CodeBehind:

LinkItemCollection list = TargetPage["RelatedInfo"] as LinkItemCollection;

if (list != null)
                {
                    CustomLinkItemCollection customList = new CustomLinkItemCollection(list);
                    rptLinkCollection.DataSource = customList;
                    rptLinkCollection.DataBind();
                }

Then there is:
.
.
Panel panel = args.Item.FindControl("pnlItem") as Panel;
CustomLinkItem item = args.Item.DataItem as CustomLinkItem;
HyperLink link = new HyperLink();
                    link.Text = item.Text;
                    link.NavigateUrl = item.NavigateUrl;
                    link.Target = item.Target;
.
.

 

Please, can I do something with the C# to fix the link problem? If you want me to post more code, I can do that.

#57905
Apr 03, 2012 9:49
Vote:
 

Both links worked for me? :)

#57906
Apr 03, 2012 10:25
Vote:
 

Really? Only one works for me (the one in mainbody), the one in the green column does not work.

Three people here have tested it (PC, Mac - FF, IE8, Safari).

Some it doesnt work for?

#57910
Apr 03, 2012 12:26
Vote:
 

Try decoding the NavigateUrl.

Something like

link.NavigateUrl = HttpUtility.UrlDecode(item.NavigateUrl);

     

#57917
Apr 03, 2012 13:06
Vote:
 

Hi Per! No sorry it doesnt work. Strange. Is it because item.NavigateURL is a string? Can I convert it to a URL (as url dont work when I try).

Iam bit of a newbie, so forgive me.

#57919
Apr 03, 2012 13:43
Vote:
 

No problem. You need to add .ToString() as well :-)

HttpUtility.UrlDecode(item.NavigateUrl).ToString();

#57920
Apr 03, 2012 13:47
Vote:
 

Like this? link.NavigateUrl = HttpUtility.UrlDecode(item.NavigateUrl).ToString();

It doesnt work, sorry. The intel also says that no actual conversion is done (when hovering the line).

#57922
Apr 03, 2012 13:53
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.