November Happy Hour will be moved to Thursday December 5th.

Class SubscriptionList

Display a list of subscription options

Inheritance
System.Object
SubscriptionList
Implements
System.ComponentModel.INotifyPropertyChanged
System.Collections.IEnumerable
System.Web.UI.INamingContainer
Namespace: EPiServer.Web.WebControls
Assembly: EPiServer.Cms.AspNet.dll
Version: 11.20.7
Syntax
[Obsolete("The subscription feature is being phased out, it will continue to work but we do recommend not using it for new solutions")]
public class SubscriptionList : PageListData, INotifyPropertyChanged, IPageControl, IEnumerable, IPageSource, INamingContainer
Examples
  If you want to change the presentation of the code produced by this control 
  you can override the CreateChildControls and SaveSubscriptions methods.
        protected override void CreateChildControls()
{
CheckBoxList list = new CheckBoxList();
PageDataCollection pages = GetPages();

foreach (PageData page in pages)
{
    ListItem item = new ListItem(page.PageName, page.PageLink.ToString());
    item.Selected = Subscription.IsSubscribingTo(page.PageLink);
    list.Items.Add(item);
}
list.SelectedIndexChanged += new EventHandler(SaveSubscriptions);
Controls.Add(list);
}

protected new void SaveSubscriptions(object sender, EventArgs e)
{
CheckBoxList list = sender as CheckBoxList;

foreach (ListItem item in list.Items)
{
    if (item.Selected)
        Subscription.SubscribeTo(PageReference.Parse(item.Value));
    else
        Subscription.UnSubscribe(PageReference.Parse(item.Value));
}
}

Constructors

SubscriptionList()

Initializes a new instance of the SubscriptionDataSource class.

Declaration
public SubscriptionList()

Properties

Language

Language for the subscription.

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

Only used for multilanguage

SubscriptionService

Gets or sets the subscription service that fetches subsciption pages.

Declaration
public Injected<SubscriptionService> SubscriptionService { get; set; }
Property Value
Type Description
Injected<SubscriptionService>

The subscription service.

Methods

CreateChildControls()

Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.

Declaration
protected override void CreateChildControls()

PopulatePages(PageDataCollection)

Called once when the control is populating the collection of pages

Declaration
protected override void PopulatePages(PageDataCollection pages)
Parameters
Type Name Description
PageDataCollection pages

Collection to populate with pages

Overrides
Remarks

Override this method to customize the population of pages, if this control has been data bound the collection may already contain pages.

Examples

Example how a list control may choose to implement this method

protected override void PopulatePages(PageDataCollection pages)
{
if(PageLink.ID!=0)
GetChildren(PageLink,pages);
}

SaveSubscriptions(Object, EventArgs)

Saves the subscriptions.

Declaration
protected void SaveSubscriptions(object sender, EventArgs e)
Parameters
Type Name Description
System.Object sender

The sender.

System.EventArgs e

The System.EventArgs instance containing the event data.

Implements

System.ComponentModel.INotifyPropertyChanged
System.Collections.IEnumerable
System.Web.UI.INamingContainer

Extension Methods