HtmlTextWriter.GetAttributeKey メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > HtmlTextWriter.GetAttributeKey メソッドの意味・解説 

HtmlTextWriter.GetAttributeKey メソッド

指定した属性対応する HtmlTextWriterAttribute 列挙値を取得します

名前空間: System.Web.UI
アセンブリ: System.Web (system.web.dll 内)
構文構文

Protected Function GetAttributeKey ( _
    attrName As String _
) As HtmlTextWriterAttribute
Dim attrName As String
Dim returnValue As HtmlTextWriterAttribute

returnValue = Me.GetAttributeKey(attrName)
protected HtmlTextWriterAttribute GetAttributeKey (
    string attrName
)
protected:
HtmlTextWriterAttribute GetAttributeKey (
    String^ attrName
)
protected HtmlTextWriterAttribute GetAttributeKey (
    String attrName
)
protected function GetAttributeKey (
    attrName : String
) : HtmlTextWriterAttribute

パラメータ

attrName

HtmlTextWriterAttribute の取得対象となる属性格納している文字列

戻り値
指定した属性HtmlTextWriterAttribute 列挙値。属性列挙値のメンバない場合HtmlTextWriterAttribute

解説解説

attrNamenull 参照 (Visual Basic では Nothing) または空の文字列 ("") の場合や、属性名のテーブルに見つからない場合は、HtmlTextWriterAttribute オブジェクトとして型指定された値 -1 が返されます。

使用例使用例

RenderBeginTag メソッドオーバーライドする HtmlTextWriter クラスから派生したクラス使用する方法次のコード例示します。このオーバーライドは、tagKeyFont フィールド等しかどうかチェックします。これは、<font> マークアップ要素出力されることを示します等し場合、このオーバーライドは IsAttributeDefined メソッド呼び出して<font> 要素Size 属性含まれているかどうかチェックしますIsAttributeDefinedfalse返した場合、AddAttribute メソッドは、GetAttributeKey メソッド呼び出します。これによって、Size定義され、その値が 30pt設定されます。

' If the tagKey parameter is set to a <font> element
' but a size attribute is not defined on the element,
' the AddStyleAttribute method adds a size attribute
' and sets it to 30 point. 
If tagKey = HtmlTextWriterTag.Font Then
    If Not IsAttributeDefined(HtmlTextWriterAttribute.Size)
 Then
        AddAttribute(GetAttributeKey("size"), "30pt")
    End If
End If
// If the tagKey parameter is set to a <font> element
// but a size attribute is not defined on the element,
// the AddStyleAttribute method adds a size attribute
// and sets it to 30 point. 
if (tagKey == HtmlTextWriterTag.Font)
{
    if (!IsAttributeDefined(HtmlTextWriterAttribute.Size))
    {
        AddAttribute(GetAttributeKey("size"), "30pt");
    }
}
// If the tagKey parameter is set to a <font> element
// but a size attribute is not defined on the element,
// the AddStyleAttribute method adds a size attribute
// and sets it to 30 point.
if ( tagKey == HtmlTextWriterTag::Font )
{
   if (  !IsAttributeDefined( HtmlTextWriterAttribute::Size )
 )
   {
      AddAttribute( GetAttributeKey( "size" ), "30pt" );
   }
}
// If the tagKey parameter is set to a <font> element
// but a size attribute is not defined on the element,
// the AddStyleAttribute method call adds a size attribute
// and sets it to 30 point. 
if (tagKey.Equals(HtmlTextWriterTag.Font)) {
    if (!(IsAttributeDefined(HtmlTextWriterAttribute.Size))) {
        AddAttribute(GetAttributeKey("size"), "30pt");
    }
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
HtmlTextWriter クラス
HtmlTextWriter メンバ
System.Web.UI 名前空間
TextWriter
HtmlTextWriterAttribute
RenderBeginTag
IsAttributeDefined
AddAttribute


このページでは「.NET Framework クラス ライブラリ リファレンス」からHtmlTextWriter.GetAttributeKey メソッドを検索した結果を表示しています。
Weblioに収録されているすべての辞書からHtmlTextWriter.GetAttributeKey メソッドを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からHtmlTextWriter.GetAttributeKey メソッド を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

HtmlTextWriter.GetAttributeKey メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



HtmlTextWriter.GetAttributeKey メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS