ControlParser.ParseControl Método

Definição

Cria um controle com base na marcação especificada.Creates a control from the specified markup.

Sobrecargas

ParseControl(IDesignerHost, String)

Cria um controle com base na marcação especificada usando o host de designer especificado.Creates a control from the specified markup using the specified designer host.

ParseControl(IDesignerHost, String, String)

Cria um controle com base na marcação especificada usando as diretivas e o host de designer especificados.Creates a control from the specified markup using the specified designer host and directives.

ParseControl(IDesignerHost, String)

Cria um controle com base na marcação especificada usando o host de designer especificado.Creates a control from the specified markup using the specified designer host.

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

Parâmetros

designerHost
IDesignerHost

Uma instância IDesignerHost que é o host do designer da página.An IDesignerHost instance that is the designer host for the page.

controlText
String

A marcação HTML para o controle.The HTML markup for the control.

Retornos

Control

O Control representado por controlText; caso contrário, null se o analisador não puder criar o controle.The Control that controlText represents; otherwise, null, if the parser cannot build the control.

Exceções

Um parâmetro não é válido.A parameter is not valid.

Exemplos

O exemplo de código a seguir mostra como criar um controle de texto de marcação HTML.The following code example shows how to create a control from HTML markup text. Este exemplo de código faz parte de um exemplo maior fornecido para a ControlParser classe.This code example is part of a larger example provided for the ControlParser class.

// Create a Web control from the persisted control String*.
System::Web::UI::Control^ ctrl = ControlParser::ParseControl( host, inputForm->tbox->Text->Trim() );
// Create a Web control from the HTML markup.
System.Web.UI.Control ctrl =
    ControlParser.ParseControl(host, inputForm.TBox.Text.Trim());
' Create a Web control from the persisted control string.
Dim ctrl As System.Web.UI.Control = ControlParser.ParseControl(host, inputForm.TxBox.Text.Trim())

Comentários

O ParseControl método acessa a cadeia de caracteres que representa as diretivas de registro na página da Web ASP.NET usando os serviços do host do designer.The ParseControl method accesses the string representing the register directives on the ASP.NET Web page using the services of the designer host. Os serviços de host do designer são adquiridos por meio da ReferenceManager Propriedade do RootDesigner objeto, ou se isso não estiver disponível, o IWebFormReferenceManager serviço.Designer host services are acquired through the ReferenceManager property of the RootDesigner object, or if that is not available, the IWebFormReferenceManager service.

O ParseControl método lançará uma exceção se o analisador não puder criar o controle.The ParseControl method throws an exception if the parser cannot build the control.

Aplica-se a

ParseControl(IDesignerHost, String, String)

Cria um controle com base na marcação especificada usando as diretivas e o host de designer especificados.Creates a control from the specified markup using the specified designer host and directives.

public:
 static System::Web::UI::Control ^ ParseControl(System::ComponentModel::Design::IDesignerHost ^ designerHost, System::String ^ controlText, System::String ^ directives);
public static System.Web.UI.Control ParseControl (System.ComponentModel.Design.IDesignerHost designerHost, string controlText, string directives);
static member ParseControl : System.ComponentModel.Design.IDesignerHost * string * string -> System.Web.UI.Control
Public Shared Function ParseControl (designerHost As IDesignerHost, controlText As String, directives As String) As Control

Parâmetros

designerHost
IDesignerHost

Uma instância IDesignerHost que é o host do designer da página.An IDesignerHost instance that is the designer host for the page.

controlText
String

O texto da marcação HTML para o controle.The text of the HTML markup for the control.

directives
String

As diretivas de página a serem incluídas no código para o controle.The page directives to include in the code for the control.

Retornos

Control

O Control representado pelo controlText.The Control that controlText represents.

Exceções

Um parâmetro não é válido.A parameter is not valid.

Exemplos

O exemplo de código a seguir mostra como criar um controle de texto de marcação HTML.The following code example shows how to create a control from HTML markup text. Este exemplo de código faz parte de um exemplo maior fornecido para a ControlParser classe.This code example is part of a larger example provided for the ControlParser class.

// Create a Web control from the persisted control String*.
System::Web::UI::Control^ ctrl = ControlParser::ParseControl( host, inputForm->tbox->Text->Trim() );
// Create a Web control from the HTML markup.
System.Web.UI.Control ctrl =
    ControlParser.ParseControl(host, inputForm.TBox.Text.Trim());
' Create a Web control from the persisted control string.
Dim ctrl As System.Web.UI.Control = ControlParser.ParseControl(host, inputForm.TxBox.Text.Trim())

Comentários

O ParseControl método acessa a cadeia de caracteres que representa as diretivas de registro na página da Web ASP.NET usando os serviços do host do designer.The ParseControl method accesses the string representing the register directives on the ASP.NET Web page using the services of the designer host. Os serviços de host do designer são adquiridos por meio da ReferenceManager Propriedade do RootDesigner objeto, ou se isso não estiver disponível, o IWebFormReferenceManager serviço.Designer host services are acquired through the ReferenceManager property of the RootDesigner object, or if that is not available, the IWebFormReferenceManager service.

O ParseControl método lançará uma exceção se o analisador não puder criar o controle.The ParseControl method throws an exception if the parser cannot build the control.

Aplica-se a