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

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

WebControl.Attributes プロパティ

コントロールのプロパティに対応しない任意の属性 (表示専用) のコレクションを取得します。

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

Dim instance As WebControl
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

プロパティ値
名前と値の組み合わせの AttributeCollection。

解説解説
使用例使用例

WebControl の Attributes プロパティを使用して、TextBox コントロールがフォーカスを失ったときに、JavaScript コマンドを実行する方法の例を次に示します。

メモメモ

次のコード サンプルはシングルファイル コード モデルを使用しており、分離コード ファイルに直接コピーされた場合は正常に動作しない可能性があります。このコード サンプルは、拡張子が .aspx の空のテキスト ファイルにコピーする必要があります。Web フォームのコード モデルの詳細については、「ASP.NET Web ページのコード モデル」を参照してください。

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

 <html>
 <head>
    <script language="VB" runat="server">
 
        Sub Page_Load(sender As Object,
 e As EventArgs)
            TextBox1.Attributes("onblur") = "javascript:alert('Hello!
 Focus lost from text box!!');"
        End Sub
    </script>
 
 </head>
 <body>
    <h3>Attributes Property of a Web
 Control</h3>
 <form runat="server">
 
    <asp:TextBox id="TextBox1" columns=54 
     Text="Click here and then tap out of this text box"
 
     runat="server"/>  
 
 </form>
 </body>
 </html>
 
<%@ Page Language="C#" AutoEventWireup="True" %>

 <html>
 <head>
    <script language="C#" runat="server">
 
        void Page_Load(Object sender, EventArgs e) {
           TextBox1.Attributes["onblur"]="javascript:alert('Hello!
 Focus lost from text box!!');";    
        }
    </script>
 
 </head>
 <body>
    <h3>Attributes Property of a Web Control</h3>
 <form runat="server">
 
    <asp:TextBox id="TextBox1" columns=54 
     Text="Click here and then tap out of this text box"
 
     runat="server"/>  
 
 </form>
 </body>
 </html>
 
<%@ Page Language="JScript" AutoEventWireup="True" %>

 <html>
 <head>
    <script language="JSCRIPT" runat="server">
 
        function Page_Load(sender : Object, e : EventArgs){
            TextBox1.Attributes("onblur") = "javascript:alert('Focus
 lost from text box!!');"
        }
    </script>
 
 </head>
 <body>
    <h3>Attributes Property of a Web Control</h3>
 <form runat="server">
 
    <asp:TextBox id="TextBox1" columns=54 
     Text="Click here and then tab out of this text box"
 
     runat="server"/>  
 
 </form>
 </body>
 </html>
 
<html>
<head>
   <script language="C#" runat="server">




   </script>

</head>
<body>
   <h3><font
 face="Verdana">Attributes Property of a Web Control</font></h3>
<form runat="server">

   <asp:TextBox id="TextBox1" columns=54 
    Text="Click here and then tap out of this text box" 
    runat="server"/>  

</form>
</body>
</html>

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
WebControl クラス
WebControl メンバ
System.Web.UI.WebControls 名前空間
System.Web.UI.AttributeCollection
System.Web.UI.ClientScriptManager
その他の技術情報
Web サーバー コントロール構文
ASP.NET カスタム サーバー コントロールの開発


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

英和和英テキスト翻訳

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

辞書ショートカット

すべての辞書の索引

「WebControl.Attributes プロパティ」の関連用語

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

   

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



WebControl.Attributes プロパティのページの著作権

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

©2026 GRAS Group, Inc.RSS