HtmlSelectBuilder.GetChildControlType(String, IDictionary) Método
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
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.