SaaS CMS has officially launched! Learn more now.

Accessing PageData on PageList


I have tried to get the first PageData on an EPiServer databound PageList through code.  When trying to access the datasource for the PageList (<PageListControl>.DataSource as PageDataCollection) I am being return 'null'.

Pages exist and are being returned through the HTML InnerTemplate.

Any ideas?

Apr 14, 2011 20:07

If you are getting the pages by setting the PageLink or PageLinkProperty properties of the control, the DataSource property is null. DataSource is used if you have an enumerable collection of PageDatas that you want to display, not to get the pages the control finds itself using the PageLink.

So if you want to find the first page displayed, you could simply collect the pages yourself in code and set the DataSource property of the control to that collection instead of using PageLink. Because you have the collection you can also easily find the first page.

If you for some reason want to stay with the PageLink auto-binding solution, you can attach an event handler to the Filter event and check in there which page is the first in the collection.

Apr 15, 2011 8:34

Many thanks Magnus

Apr 15, 2011 10:11
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* 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.