Dynamicweb 8 Documentation
MarkupValidationCompleted Field
Example 

Page markup validation completed notification. Occurs after the page's content has been validated using the W3C markup validator.
Syntax
'Declaration
 
Public Const MarkupValidationCompleted As String
public const string MarkupValidationCompleted
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
Remarks
The passed NotificationArgs is 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 Class
Standard.Page Members

Send Feedback