November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Hi,
If the LinkItem.Href is not a friendly url, I suppose you could substring it and get the id?
or by
PageReference res = PermanentLinkUtility.GetPageReference(new UrlBuilder(url));
If you use Itera.MultiProperty you can loop over the item like this:
<Itera:Property ID="Property2" runat="server" PropertyName="LinksRelaterte.Links" SuppressEmpty=false >
<ItemTemplate>
<p>
{this.ToMappedLink}
Href={this.Href}<br />
PageReference={this.Href.ToPageData()}<br />
PageLink={this.Href.ToPageData().LinkURL}<br />
PageName={this.Href.ToPageData().PageName}<br />
Text={this.Text}<br />
Target={this.Target}<br />
</p>
</ItemTemplate>
</Itera:Property>
This will generate output like:
The Norwegian Embassy, Tokyo Href=~/link/f4fb6b10a78c425fbf4febf6830bd8af.aspx?epslanguage=en
PageReference=6311
PageLink=/Templates/Public/Pages/Page.aspx?id=6311&epslanguage=en
PageName=Information
Text=The Norwegian Embassy, Tokyo
Target=
thanks for the answers
my solution was to get the GUID of the page in order to use this
PermanentLinkUtility.FindPageReference(new Guid(sGuid))
but this was a temporary solution, i really wanted to use
PageReference res = PermanentLinkUtility.GetPageReference(new UrlBuilder(url));
where url i thought it would be the LinkItemCollection.LinkItem.Href but this didn't worked as expected
I am using LinkItemCollection and the target objects are LinkItem objects
It would be nice if there was a method like in your example : Href.ToPageData()
Also PageReference.ParseUrl is not helping i get a pagereference with ID 0 every time
The LinkItem.href looks something like this ~/Link/SomeGuid.aspx
Hello.
Maybe this answer comes a little bit late, but I think I have found a small solution to this. The I found the secret solution in the method: PermanentLinkMapStore.TryToMapped(linkItem.Href, out selectedOutPutString);
So what I did for short was to first get the PropertyLinkCollection, then started to loop through all the LinkItems. My purpose was only to get hold of the pages and not documents, external links, but these could easily also be handled. See my solution below:
// Create a new PageDataCollection
PageDataCollection indexPages = new PageDataCollection();
// Get the property
PropertyLinkCollection propertyIndexPages = CurrentPage.Property["IndexPages"] as PropertyLinkCollection;
// Make sure it is not null
if (propertyIndexPages != null)
{
// Loop through all the links in the property
foreach (LinkItem link in propertyIndexPages.Links)
{
// Create the output strin
string linkUrl = string.Empty;
// Try to map the link
PermanentLinkMapStore.TryToMapped(link.Href, out linkUrl);
// Make sure there is a link, Externa urls will not be mapped, but documents will.
if (!string.IsNullOrEmpty(linkUrl))
{
// Try to cast to a PageReference
PageReference pageRef = PageReference.ParseUrl(linkUrl);
// In this case only add Pages, you could here also handle documents
if(!PageReference.IsNullOrEmpty(pageRef))
indexPages.Add(GetPage(pageRef));
}
}
}
Hope this could help a little bit.
regards
gustaf
I need to read properties from the pages added to a Link Colection
Any ideea how could I obtain a reference to each page in a Link Collection property?
I have the link to the page in the LinkItem object how can i use it or maybe if there is any other way please let me know