共用方式為


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

傳回

String

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

範例

下列程式碼範例示範如何使用 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))

備註

如果 attrKey 不是有效的 HtmlTextWriterAttribute 值,此方法 GetAttributeName 會傳回空字串 (「」「) 。

適用於

另請參閱