HtmlSelectBuilder.GetChildControlType(String, IDictionary) Metode
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Type Mendapatkan untuk HtmlSelect kontrol anak kontrol.
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
Parameter
- tagName
- String
Nama tag kontrol anak.
- attribs
- IDictionary
Array atribut yang terkandung dalam kontrol anak.
Mengembalikan
Kontrol Type turunan HtmlSelect kontrol yang ditentukan.
Contoh
Contoh kode berikut menunjukkan cara mengambil alih GetChildControlType metode untuk memeriksa jenis kontrol anak kustom. Untuk contoh kode kerja yang lengkap, lihat HtmlSelectBuilder topik gambaran umum kelas.
[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
Keterangan
GetChildControlType Gunakan metode untuk mengembalikan Type kontrol anak tertentu dalam HtmlSelect kontrol.