ControlDesigner.ViewControl Property

Gets or sets a Web server control that can be used for previewing the design-time HTML markup.

Namespace: System.Web.UI.Design
Assembly: System.Design (in system.design.dll)

public:
property Control^ ViewControl {
	Control^ get ();
	void set (Control^ value);
}
/** @property */
public Control get_ViewControl ()

/** @property */
public void set_ViewControl (Control value)

public function get ViewControl () : Control

public function set ViewControl (value : Control)

Not applicable.

Property Value

A Control object used by the base class to generate design-time HTML markup.

The ViewControl property uses the UsePreviewControl property to determine its return value.

If the UsePreviewControl property is true, the ViewControl property returns a temporary copy of the control. Changes to the temporary control are not persisted.

If the UsePreviewControl property is false, the ViewControl property returns an instance of the Component property for the control. Changes to the instance of the control are persisted.

The SupportsPreviewControl setting in the SupportsPreviewControlAttribute object is used to set the value of the UsePreviewControl property. Therefore, the SupportsPreviewControl setting determines the type of control that is returned by the ViewControl property in the base ControlDesigner class. If the SupportsPreviewControlAttribute is not specified in the control designer declaration, the ControlDesigner object behavior is equivalent to specifying the SupportsPreviewControl property as false.

The following code example demonstrates how to mark a control designer with the SupportsPreviewControlAttribute attribute. The code example derives a Web server control from the Label class and associates the control with a custom control designer implementation. The control designer class declaration is marked with the SupportsPreviewControl attribute set to true. The control designer overrides the GetDesignTimeHtml method, and then displays the Text property of the control in italic at design time.

No code example is currently available or this language may not be supported.

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

ADD
Show: