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.
Getting the page in the loop was just a typo :)
It's the empty page i try to avoid... i'll check CreatePageData.
Hi, I can't give you any details yet but look out for some data storage goodies in the
upcoming CMS 6 CTP .
Paul Smith, EPiServer Development Team.
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:
http://world.episerver.com/en/Articles/Items/Introducing-Page-Providers/
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.
Regards,
Johan Olofsson
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);
pages.Add(p);
}
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...