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))

注解

如果不是有效HtmlTextWriterAttribute值,attrKey该方法GetAttributeName将返回空字符串 (“”) 。

适用于

另请参阅