This documentation is archived and is not being maintained.

NonVisualControlAttribute Constructor (Boolean)

Initializes a new instance of the NonVisualControlAttribute class, using the specified Boolean value to determine whether the attribute represents a visual or non-visual control.

Namespace:  System.Web.UI
Assembly:  System.Web (in System.Web.dll)

public NonVisualControlAttribute(
	bool nonVisual


Type: System.Boolean
true to initialize the NonVisualControlAttribute to represent a Web control that is not rendered to the client at run time; otherwise, false.

Passing true to this constructor is equivalent to using the NonVisual field, and passing false is equivalent to using the Visual field.

The following code example demonstrates how you can apply the NonVisualControlAttribute attribute to a class. In this example, a data source control is designated as a non-visual control by passing true to the attribute.

public class CustomNonVisualControl2 : Control
    // Add an implementation of custom non-visual control.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

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

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.