Our monthly Virtual Happy Hour is happening this week, Fri Feb 23!

Try our conversational search powered by Generative AI!

using PageData for storing data


For some reasons, i need to use the PageData-object to so store data that is not EPiServer pages. Populating the PageData object with data and put it in a PageDataCollection works great, but when i try to use it as datasource for a PageList, and doesn't show anything. I guess it's because some properties doesn't have the correct values (like Status).

I didn't really fins a good way of solving this. At the moment i have a blank page stored from which i create a writable clone like this: 

PageDataCollection pages = new PageDatacollection();
foreach(string x in somedata)
PageData p = DataFactory.Instance.GetPage(PageReference.Parse("102")).CreateWritableClone();
p.SetValue("PageName", x);

But i'm not very happy with that solution. I would really like to avoid the CreateWritableclone part and just create a new PageData, add som properties and put it in i collection... for sure this must be possible. any ideas? And i don''t want to crreate a PageProvider...

Sep 17, 2009 19:43

If you just want to avoid the overhead of getting the page in each loop, just store one object as a prototype and clone it in each loop.

If you want to avoid the empty real page I have no solution, but check out the EPiServer.Core.CreatePageData class' static methods if you haven't already. Maybe there's help in there.

Sep 18, 2009 6:37

Getting the page in the loop was just a typo :)

It's the empty page i try to avoid... i'll check CreatePageData.

Sep 18, 2009 7:08

Hi, I can't give you any details yet but look out for some data storage goodies in the

upcoming CMS 6 CTP Laughing.


Paul Smith, EPiServer Development Team. 

Sep 18, 2009 8:17

Hi Jonas!

 As Paul said, there are things going on regarding data storage in the upcoming EPiServer CMS6

However, I got the impression that you have "data" thats _not_ EPiServer Pages but still want to render them as such?

I'd strongly suggest you to instead look into "Custom Page Providers" introduced in EPiServer CMS5 R2, this is exactly the kind of things it was invented for:

Still, if you really want to instantiate the PageData's objects manuaklly, take a look at the DataFactory.GetDefaultPage() method, it'll return you a PageData with necessary metadata properties added.

Johan Olofsson

Sep 18, 2009 9:10
* 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.