Display a list of subscription options

Namespace:  EPiServer.Web.WebControls
Assembly:  EPiServer (in EPiServer.dll) Version: 5.2.375.236

Syntax

C#
public class SubscriptionList : PageListData, 
	INamingContainer

Examples

If you want to change the presentation of the code produced by this control you can override the CreateChildControls and SaveSubscriptions methods.
CopyC#
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));
    }
}

Inheritance Hierarchy

System..::.Object
  System.Web.UI..::.Control
    EPiServer.Web.WebControls..::.PageControlBase
      EPiServer.Web.WebControls..::.PageListData
        EPiServer.Web.WebControls..::.SubscriptionList

See Also