HtmlTextWriter.GetAttributeName(HtmlTextWriterAttribute) 方法
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得與指定的 HtmlTextWriterAttribute 值相關聯的標記屬性名稱。
protected:
System::String ^ GetAttributeName(System::Web::UI::HtmlTextWriterAttribute attrKey);
C#
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 ) );
C#
// 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 會傳回空字串 (「」「) 。
產品 | 版本 |
---|---|
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8 |