HtmlControl.GetAttribute(String) 方法

定義

取得 HtmlControl 控制項上已命名屬性的值。Gets the value of the named attribute on the HtmlControl control.

protected:
 virtual System::String ^ GetAttribute(System::String ^ name);
protected virtual string GetAttribute (string name);
abstract member GetAttribute : string -> string
override this.GetAttribute : string -> string
Protected Overridable Function GetAttribute (name As String) As String

參數

name
String

屬性的名稱。The name of the attribute. 這個引數不區分大小寫。This argument is case-insensitive.

傳回

項目上這個屬性的值,為 String 值。The value of this attribute on the element, as a String value. 如果指定的屬性不存在這個項目上,則會傳回空字串 ("")。If the specified attribute does not exist on this element, returns an empty string ("").

實作

備註

使用方法來存取HtmlControl伺服器控制項上的屬性。 GetAttributeUse the GetAttribute method to access an attribute on the HtmlControl server control. 所有 HTML 伺服器控制項都會將其屬性儲存Control.ViewState在屬性中。All HTML server controls store their attributes in the Control.ViewState property. HTML 屬性會由 ASP.NET 網頁架構視為其所屬 HTML 伺服器控制項上的屬性。HTML attributes are treated by the ASP.NET page framework as properties on the HTML server control to which they belong. GetAttribute方法的name參數不區分大小寫。The GetAttribute method's name parameter is case-insensitive.

適用於

另請參閱