Comparteix a través de


HtmlSelectBuilder.GetChildControlType(String, IDictionary) Método

Definición

Obtiene el Type de los controles secundarios del control HtmlSelect.

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

Nombre de etiqueta del control secundario.

attribs
IDictionary

Matriz de atributos contenidos en el control secundario.

Devoluciones

Type

Objeto Type del control secundario especificado del control HtmlSelect.

Ejemplos

En el ejemplo de código siguiente se muestra cómo invalidar el GetChildControlType método para comprobar los tipos de control secundarios personalizados. Para obtener un ejemplo de código completo y funcional, consulte el tema de información general de la HtmlSelectBuilder clase.

[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

Comentarios

Use el GetChildControlType método para devolver el Type de un control secundario especificado en un HtmlSelect control .

Se aplica a

Consulte también