Problems with ÅÄÖ in URL in linklist



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

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):

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;

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.

Apr 03, 2012 9:49

Both links worked for me? :)

Apr 03, 2012 10:25

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?

Apr 03, 2012 12:26

Try decoding the NavigateUrl.

Something like

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


Apr 03, 2012 13:06

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.

Apr 03, 2012 13:43

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


Apr 03, 2012 13:47

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).

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.