you, you need to use PageTypeBuilder to do this from my experience
Gaaah, works on some but not on others.
Thanks Joshua. Error handling...
Do all the pagetypes inherit from typed page data. or is container.DataItem null. that could be an issue since it can't cast to type Pagedata
Yes, they do inherit from Pagedata, through base classes.
The DataItem should not be null. It all worked before the upgrade to R2
What is the error that you are recieving now
<EPiServer:PageList runat="server" ID="ConnectedArticles">
<EPiServer:Property ID="Property3" runat="server" PropertyName="PageLink" />
<p class="timestamp"><%# ReturnPublishDate((EPiServer.Core.PageData)Container.DataItem)%> |
<div class="mainBody ingress">
Actually this PageList works - no errors, but it would be better using a method converting to correct page type or using code behind instead of the page(view).
Weird, i have used this on all my 6r2 projects and it works. Is it something maybe that isn't of type article. I haven't ran into that issue.
I wrote an extension method for passing in data item and returns the type instead of that long chain of code. data.Get<Article>() returns article page.
Yepp, got some help from Joel Abrahamson and trying out with the AsTyped extension.
.AsTyped() when getting a PageCollection solved it.
PageDataCollection pdc = DataFactory.Instance.FindPagesWithCriteria(pageLink, criterias).AsTyped();
Thank you for your help, Joshua,
After upgrading to R2 I'm getting errors in PageList when casting from PageBase to custom PageType (created with PageTypeBuilder).