Bagikan melalui


UserControl.Attributes Properti

Definisi

Mendapatkan kumpulan semua nama atribut dan pasangan nilai yang dideklarasikan dalam tag kontrol pengguna dalam file .aspx.

public:
 property System::Web::UI::AttributeCollection ^ Attributes { System::Web::UI::AttributeCollection ^ get(); };
[System.ComponentModel.Browsable(false)]
public System.Web.UI.AttributeCollection Attributes { get; }
[<System.ComponentModel.Browsable(false)>]
member this.Attributes : System.Web.UI.AttributeCollection
Public ReadOnly Property Attributes As AttributeCollection

Nilai Properti

Objek AttributeCollection yang berisi semua pasangan nama dan nilai yang dideklarasikan dalam tag kontrol pengguna.

Atribut

Contoh

Contoh kode berikut menggunakan properti kontrol Attributes pengguna untuk mengakses atribut yang Message dideklarasikan dalam tag kontrol kustom yang membuat instans kontrol pengguna pada halaman yang berisinya.

// Retrieve and display the 'Message' attribute tag 
// initialized in the .aspx code.
Response.Write("<b>Message tag value declared in the aspx file is : </b>" + myControl.Attributes["Message"]);
' Retrieve and display the 'Message' attribute tag 
' initialized in the .aspx code.
Response.Write("<b>Message tag value declared in the aspx file is : </b>" + myControl.Attributes("Message"))                    

Berlaku untuk

Lihat juga