HtmlControl.Attributes プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > HtmlControl.Attributes プロパティの意味・解説 

HtmlControl.Attributes プロパティ

ASP.NET ページ内にある、サーバー コントロール タグ表現されるすべての属性名/値ペアコレクション取得します

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

Dim instance As HtmlControl
Dim value As AttributeCollection

value = instance.Attributes
public AttributeCollection Attributes { get;
 }
public:
property AttributeCollection^ Attributes {
    AttributeCollection^ get ();
}
/** @property */
public AttributeCollection get_Attributes ()
public function get Attributes
 () : AttributeCollection

プロパティ
Web ページ内にあるサーバー コントロール タグ表現されるすべての属性名と値のペアが格納されている System.Web.UI.AttributeCollection オブジェクト

解説解説
使用例使用例

Attributes プロパティ使用して、HtmlSelect コントロール属性確認する方法次のコード例示します

<%@ Page Language="VB" AutoEventWireup="True"
 %>

<html>

<script language="VB" runat="server">
    Sub Page_Load(sender As Object,
 e As EventArgs)
        Message.InnerHtml = "<h4>" & "The
 select box's attributes collection contains:"
 & "</h4>"
        
        Dim keys As IEnumerator = Select1.Attributes.Keys.GetEnumerator()
        
        While keys.MoveNext()
            
            Dim key As String
 = CType(keys.Current, String)
            Message.InnerHtml &= key & "="
 & Select1.Attributes(key) & "<br>"
        End While 
    End Sub 'Page_Load

</script>

<body>

   <h3>HtmlControl Attribute Collection Example</h3>

   Make a selection:

   <select id="Select1" 
           style="font: 12pt verdana;
                 background-color:yellow;
                 color:red;" 
           runat="server">

      <option>Item 1</option>
      <option>Item 2</option>
      <option>Item 3</option>

   </select>

   <p>

   <span id="Message" MaintainState="false"
 runat="server" />
   

</body>
</html>
   
<%@ Page Language="C#" AutoEventWireup="True" %>

<html>

<script language="C#" runat="server">
   void Page_Load(Object sender, EventArgs e) 
   {
      Message.InnerHtml = "<h4>The select box's attributes collection
 contains:</h4>";
     
      IEnumerator keys = Select.Attributes.Keys.GetEnumerator();

      while (keys.MoveNext()) 
      {

         String key = (String)keys.Current;
         Message.InnerHtml += key + "=" + Select.Attributes[key] + "<br>";

      }
   }

</script>

<body>

   <h3>HtmlControl Attribute Collection Example</h3>

   Make a selection:

   <select id="Select" 
           style="font: 12pt verdana;
                 background-color:yellow;
                 color:red;" 
           runat="server">

      <option>Item 1</option>
      <option>Item 2</option>
      <option>Item 3</option>

   </select>

   <p>

   <span id="Message" MaintainState="false"
 runat="server" />
   

</body>
</html>
   
<%@ Page Language="JScript" AutoEventWireup="True" %>

<html>

<script language="jscript" runat="server">
    function Page_Load(sender: Object, e: EventArgs){
        Message.InnerHtml = "<h4>The select box's attributes collection
 contains:</h4>"
        
        var keys: IEnumerator = Select1.Attributes.Keys.GetEnumerator()
        
        while(keys.MoveNext()){
            var key: String = String(keys.Current)
            Message.InnerHtml += key + "=" + Select1.Attributes(key) +
 "<br>"
        }
    }

</script>

<body>

   <h3>HtmlControl Attribute Collection Example</h3>

   Make a selection:

   <select id="Select1" 
           style="font: 12pt verdana;
                 background-color:yellow;
                 color:red;" 
           runat="server">

      <option>Item 1</option>
      <option>Item 2</option>
      <option>Item 3</option>

   </select>

   <p>

   <span id="Message" MaintainState="false"
 runat="server" />
   

</body>
</html>
   
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
HtmlControl クラス
HtmlControl メンバ
System.Web.UI.HtmlControls 名前空間
System.Web.UI.AttributeCollection
Control.ViewState
HtmlSelect


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

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

辞書ショートカット

すべての辞書の索引

HtmlControl.Attributes プロパティのお隣キーワード
検索ランキング

   

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



HtmlControl.Attributes プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS