HtmlLink クラスとは? わかりやすく解説

HtmlLink クラス

メモ : このクラスは、.NET Framework version 2.0新しく追加されたものです。

サーバーHTML <link> 要素へのプログラムによるアクセス許可します

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

Public Class HtmlLink
    Inherits HtmlControl
public class HtmlLink : HtmlControl
public class HtmlLink extends HtmlControl
public class HtmlLink extends
 HtmlControl
解説解説
使用例使用例

HtmlLink コントロール使用しプログラムかスタイル シートWeb ページ追加する方法次のコード例示します

<%@ Page Language="VB" %>
<script runat="server">

  Protected Sub Page_Init(ByVal
 sender As Object, ByVal
 e As System.EventArgs)
    
    ' Define an HtmlLink control.
    Dim myHtmlLink As New
 HtmlLink()
    myHtmlLink.Href = "~/StyleSheet.css"
    myHtmlLink.Attributes.Add("rel", "stylesheet")
    myHtmlLink.Attributes.Add("type", "text/css")
    
    ' Add the HtmlLink to the Head section of the page.
    Page.Header.Controls.Add(myHtmlLink)

  End Sub
  
</script>
<html  >
  <head id="head1" 
        runat="server">
    <title>HtmlLink Example Page</title>
  </head>
  <body>
    <form id="form1" 
          runat="server">
      <h1>HtmlLink Example Page</h1>
      This is some text in the body of
 the Web Forms page.
    </form>
  </body>
</html>
<%@ Page Language="C#"%>
<script runat="server">

  protected void Page_Init(object sender, EventArgs
 e)
  {
    // Define an HtmlLink control.
    HtmlLink myHtmlLink = new HtmlLink();
    myHtmlLink.Href = "~/StyleSheet.css";
    myHtmlLink.Attributes.Add("rel", "stylesheet");
    myHtmlLink.Attributes.Add("type", "text/css");
    
    // Add the HtmlLink to the Head section of the page.
    Page.Header.Controls.Add(myHtmlLink);
    
  }
</script>
<script>

</script>
<html>
  <head id="head1" 
        runat="server">
    <title>HtmlLink Example Page</title>
  </head>
  <body>
    <form id="form1" 
          runat="server">
      <h1>HtmlLink Example Page</h1>
      This is some text in the body of the Web Forms page.
    </form>
  </body>
</html>

上記コード実行するには、次のコード含まれている Stylesheet.css というカスケード スタイル シート (CSS) が必要です。このスタイル シートは、使用している Web サイトと同じディレクトリ保存されています。

body {
  padding-left: 11em;
  font-family:  Verdana, "Times New Roman",
        Times, serif;
  color: blue;
  background-color: silver }
h1 {
  font-family: Helvetica, Geneva, Arial,
        SunSans-Regular, sans-serif; 
  color: purple }
body {
  padding-left: 11em;
  font-family:  Verdana, "Times New Roman",
        Times, serif;
  color: blue;
  background-color: silver }
h1 {
  font-family: Helvetica, Geneva, Arial,
        SunSans-Regular, sans-serif; 
  color: purple }
.NET Framework のセキュリティ.NET Frameworkセキュリティ
継承階層継承階層
System.Object
   System.Web.UI.Control
     System.Web.UI.HtmlControls.HtmlControl
      System.Web.UI.HtmlControls.HtmlLink
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


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

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

辞書ショートカット

すべての辞書の索引

「HtmlLink クラス」の関連用語

HtmlLink クラスのお隣キーワード
検索ランキング

   

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



HtmlLink クラスのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS