Try our conversational search powered by Generative AI!

Class PageDataSource

Provides PageData data to DataBoundControl and HierarchicalDataBoundControl implementations.

Inheritance
System.Object
PageDataSource
Implements
System.Web.UI.IDataSource
System.ComponentModel.IListSource
System.Web.UI.IHierarchicalDataSource
Namespace: EPiServer.Web.WebControls
Assembly: EPiServer.Web.WebControls.dll
Version: 11.20.7
Syntax
public class PageDataSource : Control, IDataSource, IListSource, IHierarchicalDataSource, IDataSourceMethods

Constructors

PageDataSource()

Default constructor

Declaration
public PageDataSource()

Properties

AccessLevel

Gets or sets the required access to the pages.

Declaration
public AccessLevel AccessLevel { get; set; }
Property Value
Type Description
AccessLevel

ContainsListCollection

Declaration
public bool ContainsListCollection { get; }
Property Value
Type Description
System.Boolean

DataFactory

Declaration
public IContentRepository DataFactory { get; set; }
Property Value
Type Description
IContentRepository

EnableVisibleInMenu

Gets or sets whether to recognize the "visible in menu" setting for pages. If set to true, only pages where PageVisibleInMenu is true will be returned in the result.

Declaration
public bool EnableVisibleInMenu { get; set; }
Property Value
Type Description
System.Boolean

EvaluateHasChildren

Gets or sets whether the hierarchical view should preevaluate the existens of child pages or always return true to let the HierarchicalDataBoundControl evaluate it as needed.

Declaration
public bool EvaluateHasChildren { get; set; }
Property Value
Type Description
System.Boolean

FilterPagesWithoutTemplate

Gets or sets whether pages that does not have a template should be removed.

Declaration
public bool FilterPagesWithoutTemplate { get; set; }
Property Value
Type Description
System.Boolean
Remarks

Default value is true.

IncludeRootPage

Gets or sets whether to include the root page in a hierarchical view.

Declaration
public bool IncludeRootPage { get; set; }
Property Value
Type Description
System.Boolean

MaxCount

Restrict listing to a maximum number of pages.

Declaration
public int MaxCount { get; set; }
Property Value
Type Description
System.Int32
Remarks

Default value is -1 which means "Show all pages". Note that 0 menas no pages.

Gets or sets the root page for a hierarchical view or the parent page for the listed pages in a tabular view.

Declaration
public PageReference PageLink { get; set; }
Property Value
Type Description
PageReference

PageLinkProperty

The property that contains the root page to read data from if different from current

Declaration
public string PageLinkProperty { get; set; }
Property Value
Type Description
System.String

PageLoader

Declaration
public virtual HierarchicalPageLoader PageLoader { get; }
Property Value
Type Description
HierarchicalPageLoader

Pages

Gets the list representing the partially loaded child pages

Declaration
protected PartialList<int> Pages { get; }
Property Value
Type Description
PartialList<System.Int32>

PageSource

Return the IPageSource implementation that this property control uses to read page data.

Declaration
public IPageSource PageSource { get; set; }
Property Value
Type Description
IPageSource

An IPageSource implementation.

Remarks

The returned instance will usually be the base class for the aspx-page.

PageTypeID

Gets or sets a PageTypeID value limiting the data to only containing pages with the specified page type.

Declaration
public int PageTypeID { get; set; }
Property Value
Type Description
System.Int32

PropertyResolver

Gets or sets the PropertyResolver that should be used by the current control instance.

Declaration
protected Injected<PropertyResolver> PropertyResolver { get; set; }
Property Value
Type Description
Injected<PropertyResolver>

PublishedStatus

Gets or sets the publish status of the pages.

Declaration
public PagePublishedStatus PublishedStatus { get; set; }
Property Value
Type Description
PagePublishedStatus

SelectParameters

Gets the parameters collection that contains the parameters that are used when selecting pages.

Declaration
public ParameterCollection SelectParameters { get; }
Property Value
Type Description
System.Web.UI.WebControls.ParameterCollection

SelectValues

Gets a dictionary containing entries defined by SelectParameters

Declaration
protected IDictionary SelectValues { get; }
Property Value
Type Description
System.Collections.IDictionary

SessionId

Gets the session id used as key for caching the list of partially loaded child pages

Declaration
protected Guid SessionId { get; }
Property Value
Type Description
System.Guid

SkipCount

Skip the first x pages in listings

Declaration
public int SkipCount { get; set; }
Property Value
Type Description
System.Int32

SortBy

Custom sorting on a property instead of using predefined sorting by setting SortOrder

Declaration
public string SortBy { get; set; }
Property Value
Type Description
System.String

SortDirection

Direction for sorting listings specified by SortBy

Declaration
public FilterSortDirection SortDirection { get; set; }
Property Value
Type Description
FilterSortDirection

SortOrder

Predefined sort orders instead of using custom sorting by setting SortBy

Declaration
public FilterSortOrder SortOrder { get; set; }
Property Value
Type Description
FilterSortOrder

UseFallbackLanguage

Gets or sets wether fallback to master language should be used when fetching pages.

Declaration
public bool UseFallbackLanguage { get; set; }
Property Value
Type Description
System.Boolean

true if fallback language should be used; otherwise, false.

View

Gets the view for tabular controls.

Declaration
protected virtual GenericDataSourceView<PageDataSource> View { get; }
Property Value
Type Description
GenericDataSourceView<PageDataSource>

Methods

CreatePostSortFilters()

Called once when the control needs access to post sort filters used for modifying a PageDataCollection.

Declaration
protected virtual void CreatePostSortFilters()
Remarks

Override this method to customize the population of filters to run after sorting occurs.

Typical use is to limit the number of pages, for example by using FilterCount or FilterSkipCount

CreatePreSortFilters()

Called once when the control needs access to pre sort filters used for modifying a PageDataCollection.

Declaration
protected virtual void CreatePreSortFilters()
Remarks

Override this method to customize the population of filters to run before sorting occurs.

Typical use is to add pages to create a combined list from two or more folders, or to remove pages based that should not appear in listing. For example by using FilterCompareTo

CreateSortFilters()

Called once when the control needs access to sort filters used for modifying a PageDataCollection.

Declaration
protected virtual void CreateSortFilters()
Remarks

Override this method to customize the population of sorting filters.

Typically used to change the order between pages, for example with FilterPropertySort.

Delete(IDictionary)

Deletes a Page (and any children of the page) as specified by the PageLink entry in the keys collection or the DeleteParameters collection.

Declaration
public virtual int Delete(IDictionary values)
Parameters
Type Name Description
System.Collections.IDictionary values

The values passed to delete. Should include a param PageLink of type PageReference

Returns
Type Description
System.Int32

a value

GetChildren(PageReference, Int32, Int32, out Int32)

Gets the paged and filtered children of a specified page Used when retreiving data for a paging data bound control.

Declaration
protected PageDataCollection GetChildren(PageReference pageLink, int startIndex, int maxRows, out int loaded)
Parameters
Type Name Description
PageReference pageLink

The page for which the children should be loaded

System.Int32 startIndex
System.Int32 maxRows
System.Int32 loaded
Returns
Type Description
PageDataCollection

A filtered PageDataCollection

GetHierarchicalView(String)

Declaration
public HierarchicalDataSourceView GetHierarchicalView(string viewPath)
Parameters
Type Name Description
System.String viewPath
Returns
Type Description
System.Web.UI.HierarchicalDataSourceView

GetList()

Declaration
public IList GetList()
Returns
Type Description
System.Collections.IList

Gets the current PageLink based on the settings of the PageLink and PageLinkProperty properties.

Declaration
protected virtual PageReference GetPageLink()
Returns
Type Description
PageReference

A PageReference.

GetView(String)

Declaration
public virtual DataSourceView GetView(string viewName)
Parameters
Type Name Description
System.String viewName
Returns
Type Description
System.Web.UI.DataSourceView

GetViewNames()

Declaration
public ICollection GetViewNames()
Returns
Type Description
System.Collections.ICollection

HierarchicalSelect(String)

Performs the selection of pages based on the viewPath parameter.

Declaration
public virtual PageHierarchicalEnumerable HierarchicalSelect(string viewPath)
Parameters
Type Name Description
System.String viewPath

The hierarchical path of the node to enumerate.

Returns
Type Description
PageHierarchicalEnumerable

An IHierarchicalEnumerable representing the child structure of the specified path.

Remarks

Override this method to implement custom hierarchical behavior.

InitializePageLoader(HierarchicalPageLoader)

Initialize the PageLoader with callbacks and filters. Can be overloaded to change the GetPageCallback, InitializeCallback, and InitializeCallback on the HierarchicalPageLoader object

Declaration
protected virtual void InitializePageLoader(HierarchicalPageLoader pageLoader)
Parameters
Type Name Description
HierarchicalPageLoader pageLoader

object to set the callbacks on

Remarks

Sets the pageLoader.GetChildrenCallback to get the children with AutoDetect and filters pages with selected access level. Sets the pageLoader.GetPageCallback to get the PageData with AutoDetect. Sets the pageLoader.InitializeCallback to set the loader properties (calls SetLoaderProperties) It also creates presort filters, sort filters, and postsort filters.

Insert(IDictionary)

Declaration
public virtual int Insert(IDictionary values)
Parameters
Type Name Description
System.Collections.IDictionary values
Returns
Type Description
System.Int32

OnDataSourceChanged(EventArgs)

Raises the DataSourceChanged event.

Declaration
protected virtual void OnDataSourceChanged(EventArgs e)
Parameters
Type Name Description
System.EventArgs e

OnInit(EventArgs)

Raises the System.Web.UI.Control.Init event and attaches an event handler for the System.Web.UI.Page.LoadComplete event.

Declaration
protected override void OnInit(EventArgs e)
Parameters
Type Name Description
System.EventArgs e

An System.EventArgs object that contains the event data.

OnLoad(EventArgs)

Raises the System.Web.UI.Control.Load event and invalidates the SessionId in the cache.

Declaration
protected override void OnLoad(EventArgs e)
Parameters
Type Name Description
System.EventArgs e

The System.EventArgs object that contains the event data.

Select(DataSourceSelectArguments)

Returns the actual data of the data source.

Declaration
public virtual IEnumerable Select(DataSourceSelectArguments arguments)
Parameters
Type Name Description
System.Web.UI.DataSourceSelectArguments arguments
Returns
Type Description
System.Collections.IEnumerable

an enumeration of PageData objects

SetLoaderProperties()

Sets the loader properties. This method must be called prior to handing out the loader to the Hierarchical object model (PageHierarchicalEnumerable, PageHierarchicalView etc.)

Declaration
protected virtual void SetLoaderProperties()

Update(IDictionary)

Declaration
public virtual int Update(IDictionary values)
Parameters
Type Name Description
System.Collections.IDictionary values
Returns
Type Description
System.Int32

Events

DataSourceChanged

Declaration
public event EventHandler DataSourceChanged
Event Type
Type Description
System.EventHandler

Deleted

Declaration
public event DataSourceStatusEventHandler Deleted
Event Type
Type Description
DataSourceStatusEventHandler

Deleting

Declaration
public event DataSourceMethodEventHandler Deleting
Event Type
Type Description
DataSourceMethodEventHandler

Filter

Exposes the Filter event of the underlying HierarchicalPageLoader.

Declaration
public event FilterEventHandler Filter
Event Type
Type Description
FilterEventHandler

Selected

Declaration
public event DataSourceStatusEventHandler Selected
Event Type
Type Description
DataSourceStatusEventHandler

Selecting

Declaration
public event DataSourceMethodEventHandler Selecting
Event Type
Type Description
DataSourceMethodEventHandler

Implements

System.Web.UI.IDataSource
System.ComponentModel.IListSource
System.Web.UI.IHierarchicalDataSource

Extension Methods