แก้ไข

แชร์ผ่าน


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 System::String ^ PersistControl(System::Web::UI::Control ^ control);
public static string PersistControl (System.Web.UI.Control control);
static member PersistControl : System.Web.UI.Control -> string
Public Shared Function PersistControl (control As Control) As String

Parameters

control
Control

The Control to persist.

Returns

A string that represents the persisted form of the control.

Examples

// Parse the selected control.
String^ persistedData = ControlPersister::PersistControl( controlArray[ selectionForm->controlList->SelectedIndex ] );
// Parse the selected control into a persistence string.
string persistedData = ControlPersister.PersistControl(
    controlArray[selectionForm.controlList.SelectedIndex]);
' Parse the selected control.
Dim persistedData As String = 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

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);
public static void PersistControl (System.IO.TextWriter sw, System.Web.UI.Control control);
static member PersistControl : System.IO.TextWriter * System.Web.UI.Control -> unit
Public Shared Sub PersistControl (sw As TextWriter, control As 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

PersistControl(Control, IDesignerHost)

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

public:
 static System::String ^ PersistControl(System::Web::UI::Control ^ control, System::ComponentModel::Design::IDesignerHost ^ host);
public static string PersistControl (System.Web.UI.Control control, System.ComponentModel.Design.IDesignerHost host);
static member PersistControl : System.Web.UI.Control * System.ComponentModel.Design.IDesignerHost -> string
Public Shared Function PersistControl (control As Control, host As IDesignerHost) As String

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.
String^ persistedData = ControlPersister::PersistControl( controlArray[ selectionForm->controlList->SelectedIndex ] );
// Parse the selected control into a persistence string.
string persistedData = ControlPersister.PersistControl(
    controlArray[selectionForm.controlList.SelectedIndex]);
' Parse the selected control.
Dim persistedData As String = ControlPersister.PersistControl( _
    controlArray(selectionForm.controlList.SelectedIndex))

Remarks

This method requires an IDesignerHost implementation to work correctly.

Applies to

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);
public static void PersistControl (System.IO.TextWriter sw, System.Web.UI.Control control, System.ComponentModel.Design.IDesignerHost host);
static member PersistControl : System.IO.TextWriter * System.Web.UI.Control * System.ComponentModel.Design.IDesignerHost -> unit
Public Shared Sub PersistControl (sw As TextWriter, control As Control, host As IDesignerHost)

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