You can't use the linkItem.href directly on internal links because it's in the internal permanentlink format.
If you want a link from each link item ute linkitem.ToMappedLink() or
Use PermanentLinkMapStore.TryToMapped if you want to create you're own links.
The following blog post should guide you on your way:
Yes - this is how EPiServer stores each link item in the database (as part of the PermanentLinkMapStore), if you inspect the LinkItem object you'll see that there ia a method called
.ToMappedLink() which will give you the mapped friendly url which I imagine is what you wish to render to the page.
You may also find this blog post handy Convert a LinkItemCollection to a list of PageData
Thanks, everyone. I appreciate the help.
What I was looking for was the GetMappedHref() method. This returns the correct link.
<a href="<%# ((EPiServer.SpecializedProperties.LinkItem)Container.DataItem).GetMappedHref() %> %>"><%# Eval("Text") %></a>
I'm having this problem in the edit mode on a CMS 5 site, after updating some pages programmatically. A few of the pages updated got their linkURL messed up, and displays links like the above. What causes this?
These pages have ~link/[guid].aspx style links in the edit tree as well as in page lists on the site.
Has anyone ever seen the individual items in the LinkCollection get output with links like this:
I can't see how I'm doing anything oddly, but whenever I link to a page within EPiServer within a LinkCollection, that's the link that comes out. I've debugged and gone all the back to just before I DataBind, and, indeed, this is the Href of the LinkItem objects in the LinkItemCollection.
Anyone seen this before?