ControlPersister.PersistControl Method

Definition

Gets a string of data that represents the persisted form of the specified control.

Overloads

PersistControl(Control)

Gets a string of data that represents the persisted form of the specified control.

PersistControl(TextWriter, Control)

Outputs a string of data that represents the persisted form of the specified control to the specified TextWriter.

PersistControl(Control, IDesignerHost)

Gets a string of data that represents the persisted form of the specified control, using the specified designer host.

PersistControl(TextWriter, Control, IDesignerHost)

Outputs a string of data that represents the persisted form of the specified control to the specified TextWriter, using the specified designer host.

PersistControl(Control)

Gets a string of data that represents the persisted form of the specified control.

public static string PersistControl(System.Web.UI.Control control);

Parameters

control
Control

The Control to persist.

Returns

A string that represents the persisted form of the control.

Examples

// Parse the selected control into a persistence string.
string persistedData = ControlPersister.PersistControl(
    controlArray[selectionForm.controlList.SelectedIndex]);

Remarks

This method requires an IDesignerHost implementation to work correctly. This method uses the Site of the specified control to retrieve the designer host.

Applies to

.NET Framework 4.8.1 및 기타 버전
제품 버전
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

PersistControl(TextWriter, Control)

Outputs a string of data that represents the persisted form of the specified control to the specified TextWriter.

public static void PersistControl(System.IO.TextWriter sw, System.Web.UI.Control control);

Parameters

sw
TextWriter

The TextWriter to output the persisted control data to.

control
Control

The Control to persist.

Remarks

This method requires an IDesignerHost implementation to work correctly. This method uses the Site of the specified control to retrieve the designer host.

Applies to

.NET Framework 4.8.1 및 기타 버전
제품 버전
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

PersistControl(Control, IDesignerHost)

Gets a string of data that represents the persisted form of the specified control, using the specified designer host.

public static string PersistControl(System.Web.UI.Control control, System.ComponentModel.Design.IDesignerHost host);

Parameters

control
Control

The Control to persist.

host
IDesignerHost

An IDesignerHost that is the designer host for the control.

Returns

A string that represents the persisted form of the control.

Examples

// Parse the selected control into a persistence string.
string persistedData = ControlPersister.PersistControl(
    controlArray[selectionForm.controlList.SelectedIndex]);

Remarks

This method requires an IDesignerHost implementation to work correctly.

Applies to

.NET Framework 4.8.1 및 기타 버전
제품 버전
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

PersistControl(TextWriter, Control, IDesignerHost)

Outputs a string of data that represents the persisted form of the specified control to the specified TextWriter, using the specified designer host.

public static void PersistControl(System.IO.TextWriter sw, System.Web.UI.Control control, System.ComponentModel.Design.IDesignerHost host);

Parameters

sw
TextWriter

The TextWriter to output the persisted control data to.

control
Control

The Control to persist.

host
IDesignerHost

An IDesignerHost that is the designer host for the control.

Remarks

This method requires an IDesignerHost implementation to work correctly.

Applies to

.NET Framework 4.8.1 및 기타 버전
제품 버전
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1