Click or drag to resize

NotificationsFrontendAfterSelectData Field

Occurs after the data which will be presented to the user is selected.

Namespace:  Dynamicweb.News
Assembly:  Dynamicweb.News (in Dynamicweb.News.dll) Version: 1.0.10
Syntax
public const string AfterSelectData = "DWN_MODULES_NEWSV2_FRONTEND_AFTERSELECTDATA"

Field Value

Type: String
Remarks
Examples
Example
[Dynamicweb.Extensibility.Subscribe(Dynamicweb.Notifications.NewsV2.Frontend.AfterSelectData)]
    public class NewsV2AfterSelectDataObserver : Dynamicweb.Extensibility.NotificationSubscriber
    {
        public override void OnNotify(string notification, Dynamicweb.Extensibility.NotificationArgs args)
        {
            if (args == null || !(args is Dynamicweb.NewsV2.Extensibility.FrontendDataNotificationArgs))
                return;

            Dynamicweb.NewsV2.Extensibility.FrontendDataNotificationArgs item = (Dynamicweb.NewsV2.Extensibility.FrontendDataNotificationArgs)args;

            if (item.Data == null || !(item.Data is Dynamicweb.NewsV2.NewsItemCollection))
                return;

            Dynamicweb.NewsV2.NewsItemCollection list = (Dynamicweb.NewsV2.NewsItemCollection)item.Data;

            if (list.Count > 0)
                list.RemoveAt(0); // remove first news
        }
    }
See Also