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

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

WebControl.Style プロパティ

Web サーバー コントロール外側タグスタイル属性として表示されるテキスト属性コレクション取得します

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

Dim instance As WebControl
Dim value As CssStyleCollection

value = instance.Style
public CssStyleCollection Style { get; }
public:
property CssStyleCollection^ Style {
    CssStyleCollection^ get ();
}
/** @property */
public CssStyleCollection get_Style ()
public function get Style
 () : CssStyleCollection

プロパティ
Web サーバー コントロール外側タグ表示される HTML スタイル属性を示す CssStyleCollection。

解説解説
使用例使用例

Style プロパティ使用してページLabel コントロール表示したり、非表示にしたりする方法の例を次に示します

メモメモ

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

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

<html>
 <head>
 
   <script language="VB" runat="server">
 
    Sub Button1_Click(sender As Object,
 e As EventArgs)
        If Label1.Style("visibility")
 = "hidden" Then
            Label1.Style("visibility") = "show"
        Else
            Label1.Style("visibility") = "hidden"
        End If
    End Sub
 
   </script>
 
 </head>
 <body>
 
   <h3>Style Property of a Web Control</h3>
 
 <form runat="server">
 
   <asp:Label id="Label1" Text="This
 is a label control." 
     BorderStyle="Solid" runat="server"/>
 
   <p>
 
   <asp:Button id="Button1" Text="Click
 to hide/unhide the above label"
     OnClick="Button1_Click" runat="server"/>
 
 </form>
 
 </body>
 </html>
 
<%@ Page Language="C#" AutoEventWireup="True" %>

<html>
 <head>
 
   <script language="C#" runat="server">
 
       void Button1_Click(Object sender, EventArgs e) {
          Label1.Style["visibility"]= ((Label1.Style["visibility"]=="hidden")?"show":"hidden");
       }
 
   </script>
 
 </head>
 <body>
 
   <h3>Style Property of a Web Control</h3>
 
 <form runat="server">
 
   <asp:Label id="Label1" Text="This is a label control."
 
     BorderStyle="Solid" runat="server"/>
 
   <p>
 
   <asp:Button id="Button1" Text="Click to hide/unhide the above
 label"
     OnClick="Button1_Click" runat="server"/>
 
 </form>
 
 </body>
 </html>
 
<%@ Page Language="JScript" AutoEventWireup="True" %>

<html>
 <head>
 
   <script language="JSCRIPT" runat="server">
 
    function Button1_Click(sender : Object, e : EventArgs){
        if(Label1.Style["visibility"] == "hidden")
            Label1.Style["visibility"] = "show"
        else
            Label1.Style["visibility"] = "hidden"
    }
 
   </script>
 
 </head>
 <body>
 
   <h3>Style Property of a Web Control</h3>
 
 <form runat="server">
 
   <asp:Label id="Label1" Text="This is a label control."
 
     BorderStyle="Solid" runat="server"/>
 
   <p>
 
   <asp:Button id="Button1" Text="Click to hide/unhide the above
 label"
     OnClick="Button1_Click" runat="server"/>
 
 </form>
 
 </body>
 </html>
 
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

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

   

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



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

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

©2024 GRAS Group, Inc.RSS