HtmlTextWriter.GetAttributeName(HtmlTextWriterAttribute) 方法

定義

取得與指定 HtmlTextWriterAttribute 值相關的標記屬性名稱。

protected:
 System::String ^ GetAttributeName(System::Web::UI::HtmlTextWriterAttribute attrKey);
protected string GetAttributeName(System.Web.UI.HtmlTextWriterAttribute attrKey);
member this.GetAttributeName : System.Web.UI.HtmlTextWriterAttribute -> string
Protected Function GetAttributeName (attrKey As HtmlTextWriterAttribute) As String

參數

attrKey
HtmlTextWriterAttribute

取得 HtmlTextWriterAttribute 標記屬性名稱。

傳回

一個包含標記屬性名稱的字串。

範例

以下程式碼範例說明如何使用此 GetAttributeName 方法將列舉值轉換為 Size 字串名稱。

// Use the GetAttributeName method to associate 
// the Size attribute with its HtmlTextWriteAttribute
// enumeration value in a Write method call.
Write( GetAttributeName( HtmlTextWriterAttribute::Size ) );
// Use the GetAttributeName method to associate 
// the Size attribute with its HtmlTextWriteAttribute
// enumeration value in a Write method call.
Write(GetAttributeName(HtmlTextWriterAttribute.Size));
' Use the GetAttributeName method to associate 
' the Size attribute with its HtmlTextWriteAttribute
' enumeration value in a Write method call.
writer.Write(GetAttributeName(HtmlTextWriterAttribute.Size))

備註

GetAttributeName 不是有效attrKey值,則HtmlTextWriterAttribute回傳空字串(“”)。

適用於

另請參閱