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

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

Substitution.MethodName プロパティ

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

Substitution コントロールの実行時に呼び出すコールバック メソッドの名前を取得または設定します。

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

Public Overridable Property
 MethodName As String
Dim instance As Substitution
Dim value As String

value = instance.MethodName

instance.MethodName = value
public virtual string MethodName { get;
 set; }
/** @property */
public String get_MethodName ()

/** @property */
public void set_MethodName (String value)

プロパティ値
Substitution コントロールの実行時に呼び出すメソッドの名前を表す文字列。

解説解説
使用例使用例

Substitution コントロールを出力キャッシュを使用する Web ページに宣言によって追加する方法のコード例を次に示します。ページが読み込まれると、静的な箇条書きリストがユーザーに表示されます。ページのこのセクションはキャッシュされ、60 秒ごとに更新されます。Substitution コントロールは、実行時に GetUser メソッドを呼び出します。このメソッドは現在のユーザーを表す文字列を返します。この文字列は、ページ上の Substitution コントロールの位置に表示されます。ページのこのセクションはキャッシュされず、ページの表示が更新されるたびに更新されます。

<%@ outputcache duration="60" varybyparam="none"
 %>
<script runat="server" language="VB">
  
  
  ' The Substitution control calls this method to retrieve
  ' the name of the current user from the HttpContext object. 
  ' This section of the page is exempt from output caching. 
  Shared Function GetUser(ByVal
 context As HttpContext) As String
    Return context.User.Identity.Name
  End Function
  
</script>

<html>
<head id="Head1" runat="server">
  <title>Substitution.MethodName Property Example</title>
</head>
<body>
  <form id="Form1" runat="server">
  
    <h3>Substitution.MethodName Property Example</h3>
  
    
    <!--This section of the page is not
 cached.-->
    Welcome to the site,
    <asp:substitution id="Substitution1"
      methodname="GetUser"
      runat="Server">
    </asp:substitution>
    
    <br /><br />
    
    <!--This section of the page is cached.-->
    Product list:
    <asp:bulletedlist id="ItemsBulletedList"  
           
      displaymode="Text" 
      runat="server">    
        <asp:ListItem>Product 1</asp:ListItem>
        <asp:ListItem>Product 2</asp:ListItem>
        <asp:ListItem>Product 3</asp:ListItem>
    </asp:bulletedlist>        

  </form>
</body>
</html>
<%@ outputcache duration="60" varybyparam="none" %>
<script runat="server" language="C#">  
  
  // The Substitution control calls this method to retrieve
  // the name of the current user from the HttpContext object. 
  // This section of the page is exempt from output caching. 
  public static string GetUser(HttpContext
 context)
  {
    return context.User.Identity.Name;
  }
  
</script>

<html>
<head id="Head1" runat="server">
  <title>Substitution.MethodName Property Example</title>
</head>
<body>
  <form id="Form1" runat="server">
  
    <h3>Substitution.MethodName Property Example</h3>  
    
    <!--This section of the page is not cached.-->
    Welcome to the site,
    <asp:substitution id="Substitution1"
      methodname="GetUser"
      runat="Server">
    </asp:substitution>
    
    <br /><br />
    
    <!--This section of the page is cached.-->
    Product list:
    <asp:bulletedlist id="ItemsBulletedList"             
      displaymode="Text" 
      runat="server">    
        <asp:ListItem>Product 1</asp:ListItem>
        <asp:ListItem>Product 2</asp:ListItem>
        <asp:ListItem>Product 3</asp:ListItem>
    </asp:bulletedlist>        

  </form>
</body>
</html>
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳

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

辞書ショートカット

すべての辞書の索引

「Substitution.MethodName プロパティ」の関連用語

Substitution.MethodName プロパティのお隣キーワード

   

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



Substitution.MethodName プロパティのページの著作権

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

©2026 GRAS Group, Inc.RSS