IPostBackEventHandler インターフェイス
アセンブリ: System.Web (system.web.dll 内)
構文
解説ブラウザからのフォーム送信情報をキャプチャするサーバー コントロールを作成するには、このインターフェイスを実装する必要があります。このインターフェイスの使用方法の詳細については、「ASP.NET Web ページのサーバー イベント処理」を参照してください。
使用例ポストバックを発生させるカスタム ボタン サーバー コントロールを定義し、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 のセキュリティ
プラットフォームWindows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
バージョン情報
参照IPostBackEventHandler メソッド
IPostBackEventHandler メンバ
Weblioに収録されているすべての辞書からIPostBackEventHandlerを検索する場合は、下記のリンクをクリックしてください。
全ての辞書からIPostBackEventHandler
を検索
- IPostBackEventHandlerのページへのリンク