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

Try our conversational search powered by Generative AI!

Save Data to PropertyLinkCollection

Vote:
 

I would like to save links to PropertyLinkCollection from code behind.

 PropertyLinkCollection propertyRelatedPages = pageClone.Property["RelatedPages"] as PropertyLinkCollection; // PageProperty

var linkCollectionClone = propertyRelatedPages.CreateWritableClone() as PropertyLinkCollection;
LinkItem item = new LinkItem();
var pageClone = pd.CreateWritableClone(); // Page to save PropertyLinkCollection to
/* Build the LinkItems here ....*/


linkCollectionClone.SaveData(linkCollectionClone.Value as PropertyDataCollection); // Here is the problem
// In the above line my linkCollectionClone.value  has all values but after casting to PropertyDataCollection the value turns null
                 
//pd.Property["RelatedPages"].Value = linkCollectionClone.Value as PropertyDataCollection;
//Save Page

DataFactory.Instance.Save(pageClone, EPiServer.DataAccess.SaveAction.Publish);
 
 
How can I solve this?

 

#54987
Nov 14, 2011 16:22
Vote:
 

Can't you just do: 

pageClone["RelatedPages"] = linkCollectionClone;

and then save the page?

#54988
Nov 14, 2011 16:35
Vote:
 

"God damn it, I mean Allah damn it!"

How did I miss this thanks alot.

#54993
Nov 14, 2011 17:05
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.