HtmlSelectBuilder.GetChildControlType(String, IDictionary) Método

Definição

Obtém-se para Type os HtmlSelect controlos filhos do controlo.

public:
 override Type ^ GetChildControlType(System::String ^ tagName, System::Collections::IDictionary ^ attribs);
public override Type GetChildControlType(string tagName, System.Collections.IDictionary attribs);
override this.GetChildControlType : string * System.Collections.IDictionary -> Type
Public Overrides Function GetChildControlType (tagName As String, attribs As IDictionary) As Type

Parâmetros

tagName
String

O nome da etiqueta do controlo infantil.

attribs
IDictionary

Um conjunto de atributos contidos no controlo filho.

Devoluções

O Type do HtmlSelect controlo filho especificado pelo controlo.

Exemplos

O exemplo de código seguinte demonstra como sobrescrever o GetChildControlType método para verificar tipos de controlo filhos personalizados. Para um exemplo completo e funcional de código, veja o HtmlSelectBuilder tópico de visão geral da aula.

[AspNetHostingPermission(SecurityAction.Demand, Level = AspNetHostingPermissionLevel.Minimal)]
public override Type GetChildControlType(string tagName, IDictionary attribs)
{
    // Distinguish between two possible types of child controls.
    if (tagName.ToLower().EndsWith("myoption1"))
    {
        return typeof(MyOption1);
    }
    else if (tagName.ToLower().EndsWith("myoption2"))
    {
        return typeof(MyOption2);
    }
    return null;
}
<AspNetHostingPermission(SecurityAction.Demand, Level:=AspNetHostingPermissionLevel.Minimal)> _
Public Overrides Function GetChildControlType(ByVal tagName As String, ByVal attribs As IDictionary) As Type

    ' Distinguish between two possible types of child controls.
    If tagName.ToLower().EndsWith("myoption1") Then
        Return GetType(MyOption1)
    ElseIf tagName.ToLower().EndsWith("myoption2") Then
        Return GetType(MyOption2)
    End If
    Return Nothing

End Function

Observações

Use o GetChildControlType método para devolver o Type de um controlo filho especificado num HtmlSelect controlo.

Aplica-se a

Ver também