次の方法で共有


HtmlTextWriter.GetAttributeName メソッド

指定した HtmlTextWriterAttribute 値に関連付けられた HTML 属性の名前を取得します。

Protected Function GetAttributeName( _
   ByVal attrKey As HtmlTextWriterAttribute _) As String
[C#]
protected string GetAttributeName(HtmlTextWriterAttributeattrKey);
[C++]
protected: String* GetAttributeName(HtmlTextWriterAttributeattrKey);
[JScript]
protected function GetAttributeName(
   attrKey : HtmlTextWriterAttribute) : String;

パラメータ

  • attrKey
    HTML 属性名の取得対象の HtmlTextWriterAttribute

戻り値

HTML 属性の名前。

使用例

[Visual Basic, C#, C++] RenderBeginTag メソッドをオーバーライドするカスタム HtmlTextWriter クラスの例を次に示します。このメソッドでは、出力する HTML 要素が < font > 要素かどうかをチェックし、その場合は、 size 属性の要素をチェックします。 size 属性が定義されていない場合は、 AddAttribute メソッド呼び出しの 1 番目のパラメータとして GetAttributeName メソッドを使用して、size 属性を HTML の < font > 要素に追加します。2 番目のパラメータで、 size 属性を 30 ポイントに設定します。

 
' Use the GetAttributeName method to ensure that the 
' Size attribute is written properly.
writer.Write(GetAttributeName(HtmlTextWriterAttribute.Size))

[C#] 
// Use the GetAttributeName method to ensure that the 
// Size attribute is written properly.
writer.Write(GetAttributeName(HtmlTextWriterAttribute.Size));

[C++] 
// Use the GetAttributeName method to ensure that the
// Size attribute is written properly.
writer->Write(GetAttributeName(HtmlTextWriterAttribute::Size));

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 2000, Windows XP Professional, Windows Server 2003 ファミリ

参照

HtmlTextWriter クラス | HtmlTextWriter メンバ | System.Web.UI 名前空間