Dynamicweb 8 Documentation
Standard.Page.PageValidationNotificationArgs Class
Members  Example 

Provides information about the page markup validation results.
Object Model
Standard.Page.PageValidationNotificationArgs ClassPage Class
Syntax
'Declaration
 
Public Class Standard.Page.PageValidationNotificationArgs 
   Inherits Dynamicweb.Extensibility.NotificationArgs
public class Standard.Page.PageValidationNotificationArgs : Dynamicweb.Extensibility.NotificationArgs 
Remarks
Arguments passed to Dynamicweb.Notifications.Standard.Page.MarkupValidationCompleted notification
Example
Overriding the page markup validation completed in DynamicwebOverriding the page markup validation completed in Dynamicweb
namespace Dynamicweb.Examples.CSharp.Notifications.Standard
{
    [Extensibility.Subscribe(Dynamicweb.Notifications.Standard.Page.MarkupValidationCompleted)]
    public class PageMarkupValidationCompletedObserver : Dynamicweb.Extensibility.NotificationSubscriber
    {
        public override void OnNotify(string notification, Dynamicweb.Extensibility.NotificationArgs args)
        {
            if (args == null)            
                return;            

            const string prfx = "(invalid)";

            Dynamicweb.Notifications.Standard.Page.PageValidationNotificationArgs pva = (Dynamicweb.Notifications.Standard.Page.PageValidationNotificationArgs)args;
            
            if (!pva.Result.Valid)
            {
                //If Page is not valid add "(invalid)" prefix to the page name
                pva.Target.MenuText = string.Format("{0} {1}", pva.Target.MenuText, prfx);
            }
            else
            {
                //If Page is valid remove "(invalid)" prefix if it exists from the page name
                if (pva.Target.MenuText.IndexOf(prfx) > 0)                
                    pva.Target.MenuText.Replace(prfx, string.Empty);                
            }

            pva.Target.Save();
        }
    }
}
Namespace Notifications.Standard
    <Extensibility.Subscribe(Global.Dynamicweb.Notifications.Standard.Page.MarkupValidationCompleted)> _
    Public Class PageMarkupValidationCompletedObserver
        Inherits Global.Dynamicweb.Extensibility.NotificationSubscriber

        Public Overrides Sub OnNotify(ByVal notification As String, ByVal args As Global.Dynamicweb.Extensibility.NotificationArgs)
            If args Is Nothing Then
                Return
            End If

            Const prfx As String = "(invalid)"

            Dim pva As Global.Dynamicweb.Notifications.Standard.Page.PageValidationNotificationArgs = DirectCast(args, Global.Dynamicweb.Notifications.Standard.Page.PageValidationNotificationArgs)

            If Not pva.Result.Valid Then
                'If Page is not valid add "(invalid)" prefix to the page name
                pva.Target.MenuText = String.Format("{0} {1}", pva.Target.MenuText, prfx)
            Else
                'If Page is valid remove "(invalid)" prefix if it exists from the page name
                If pva.Target.MenuText.IndexOf(prfx) > 0 Then
                    pva.Target.MenuText.Replace(prfx, String.Empty)
                End If
            End If

            pva.Target.Save()
        End Sub
    End Class
End Namespace
Inheritance Hierarchy

System.Object
   Dynamicweb.Extensibility.NotificationArgs
      Dynamicweb.Notifications.Standard.Page.PageValidationNotificationArgs

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

Standard.Page.PageValidationNotificationArgs Members
Dynamicweb.Notifications Namespace

Send Feedback