IPostBackEventHandlerとは? わかりやすく解説

IPostBackEventHandler インターフェイス

ポストバック イベントを処理するために ASP.NET サーバー コントロールに実装する必要があるメソッドを定義します。

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

Public Interface IPostBackEventHandler
Dim instance As IPostBackEventHandler
public interface IPostBackEventHandler
public interface class IPostBackEventHandler
public interface IPostBackEventHandler
public interface IPostBackEventHandler
解説解説
使用例使用例

ポストバックを発生させるカスタム ボタン サーバー コントロールを定義し、RaisePostBackEvent メソッドを使用してポストバック イベントをキャプチャして、サーバーで Click イベントを発生させるコード例を次に示します。

Imports System
Imports System.Web.UI
Imports System.Collections
Imports System.Collections.Specialized

Namespace CustomControls    
    
    <System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand,
 Name:="FullTrust")> Public
 Class MyButton
        Inherits Control
        Implements IPostBackEventHandler
        
        ' Define the Click event.
        Public Event Click As
 EventHandler
        
        
        ' Invoke delegates registered with the Click event.
        Protected Overridable Sub
 OnClick(e As EventArgs)            
            RaiseEvent Click(Me, e)
        End Sub
        
        
        ' Define the method of IPostBackEventHandler that raises change
 events.
        Public Sub RaisePostBackEvent(eventArgument
 As String) _
        Implements IPostBackEventHandler.RaisePostBackEvent
        
            OnClick(New EventArgs())
        End Sub       
        
        
        Protected Overrides Sub
 Render(output As HtmlTextWriter)
            output.Write("<INPUT TYPE = submit name = "
 & Me.UniqueID & _
                " Value = 'Click Me' />")
        End Sub
        
    End Class
End Namespace

using System;
using System.Web.UI;
using System.Collections;
using System.Collections.Specialized;

namespace CustomControls {

   [System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand,
 Name="FullTrust")]   
   public class MyButton: Control, IPostBackEventHandler
 {
      
      // Defines the Click event.
      public event EventHandler Click;
      
      //Invoke delegates registered with the Click event.
      protected virtual void OnClick(EventArgs
 e) {
         
         if (Click != null) {
            Click(this, e);
         }   
      }
      
      
      // Define the method of IPostBackEventHandler that raises change
 events.
      public void RaisePostBackEvent(string
 eventArgument){
         
         OnClick(new EventArgs());
      }
      
      
      protected override void Render(HtmlTextWriter
 output) {
         output.Write("<INPUT TYPE = submit name = " + this.UniqueID
 + 
            " Value = 'Click Me' />");   
      }
   }    
}
   
.NET Framework のセキュリティ.NET Framework のセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

IPostBackEventHandler メソッド


パブリック メソッドパブリック メソッド

  名前 説明
パブリック メソッド RaisePostBackEvent クラスによって実装された場合は、フォームがサーバーにポストされたときに発生するイベントをサーバー コントロールで処理できるようにします。
参照参照

関連項目

IPostBackEventHandler インターフェイス
System.Web.UI 名前空間

その他の技術情報

ASP.NET Web ページのサーバー イベント処理

IPostBackEventHandler メンバ




英和和英テキスト翻訳

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

辞書ショートカット

すべての辞書の索引

「IPostBackEventHandler」の関連用語

IPostBackEventHandlerのお隣キーワード
検索ランキング

   

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



IPostBackEventHandlerのページの著作権

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

©2026 GRAS Group, Inc.RSS