About Link Collection Property in EpiServer 5 R2


Dear All,

Has anyone created the Link Collection Property dynamically through code behind. My problem is, I need to create Epi-Server Pages Dynamically, which also contains a link collection property and i need to popuplate them dynamically on the fly.

 Please if some one help and send me the code.

Thanks in advance.


Oct 07, 2009 0:37

I assume (havn't tested it) that this code would do the trick:

PageData newPage = EPiServer.DataFactory.Instance.GetDefaultPageData(parentId, "pageTypeWithLinkColProperty"); 

LinkItemCollection linkCol = new EPiServer.SpecializedProperties.LinkItemCollection();

LinkItem item = new LinkItem();
item.Href = page.LinkURL;
item.Text = page.PageName;
item.Title = page.PageName;
item.Target = "_self";

newPage.Property["MyLinkItemCol"].Value = linkCol;

// set other required property values and save page

Oct 07, 2009 10:42
* 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.