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

Page.Header プロパティ

メモ : このプロパティは、.NET Framework version 2.0新しく追加されたものです。

ページ宣言head 要素runat=server使用して定義されている場合に、ドキュメントヘッダー取得します

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

Dim instance As Page
Dim value As HtmlHead

value = instance.Header
public HtmlHead Header { get; }
public:
property HtmlHead^ Header {
    HtmlHead^ get ();
}
/** @property */
public HtmlHead get_Header ()

プロパティ
ページ ヘッダー格納している HtmlHead。

解説解説
使用例使用例

Header プロパティ使用してプログラムによって HtmlHead コントロールアクセスする方法次のコード例示しますtitle 要素style 要素ページhead 要素追加されます。

<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML
 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
    
    Sub Page_Load(ByVal sender As
 Object, ByVal e As System.EventArgs)
        
        ' Create a Style object for the body of the page.
        Dim bodyStyle As New
 Style()
        
        bodyStyle.ForeColor = System.Drawing.Color.Blue
        bodyStyle.BackColor = System.Drawing.Color.LightGray
                    
        ' Add the style to the header of the current page. 
        Page.Header.StyleSheet.CreateStyleRule(bodyStyle, Nothing,
 "BODY")
            
        ' Add the page title to the header element.
        Page.Header.Title = "HtmlHead Example"

    End Sub

</script>

<html  >

<head id="head1"
      runat="server">
      <title>To be replaced.</title>
</head>

<body>
  <form id="Form1" runat="server">
  
  <h3>HtmlHead Class Example </h3>  
    
  <asp:label id="Label1" 
    text = "View the HTML source code of this page to
 see the title 
            and body style added to the header
 element."
    runat="server">
  </asp:label>   
    
  </form>
</body>
</html>
<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">  
  
  protected void Page_Load(object sender, System.EventArgs
 e)
  {
      
      // Create a Style object for the body of the page.
      Style bodyStyle = new Style();

      bodyStyle.ForeColor = System.Drawing.Color.Blue;
      bodyStyle.BackColor = System.Drawing.Color.LightGray;

      // Add the style to the header of the current page.
      Page.Header.StyleSheet.CreateStyleRule(bodyStyle, null,
 "BODY");
 
      // Add the page title to the header element.
      Page.Header.Title = "HtmlHead Example"; 
                   
  }
  
</script>

<html  >

<head id="head1"
      runat="server">
      <title>To be replaced.</title>
</head>

<body>
  <form runat="server">
  
  <h3>HtmlHead Class Example</h3>  
    
  <asp:label id="Label1" 
    text = "View the HTML source code of this page to see
 the title 
            and body style added to the header element."
    runat="server">
  </asp:label>   
    
  </form>
</body>
</html>
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

「Page.Header プロパティ」の関連用語

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

   

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



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

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

©2024 GRAS Group, Inc.RSS