TemplateControl イベント

名前 | 説明 | |
---|---|---|
![]() | AbortTransaction | ユーザーがトランザクションを終了すると発生します。 |
![]() | CommitTransaction | トランザクションが完了すると発生します。 |
![]() | DataBinding | サーバー コントロールがデータ ソースに連結すると発生します。 ( Control から継承されます。) |
![]() | Disposed | サーバー コントロールがメモリから解放されると発生します。これは、ASP.NET ページが要求されている場合のサーバー コントロールの有効期間における最終段階です。 ( Control から継承されます。) |
![]() | Error | 未処理の例外がスローされると発生します。 |
![]() | Init | サーバー コントロールが初期化されると発生します。これは、サーバー コントロールの有効期間における最初の手順です。 ( Control から継承されます。) |
![]() | Load | サーバー コントロールが Page オブジェクトに読み込まれると発生します。 ( Control から継承されます。) |
![]() | PreRender | Control オブジェクトの読み込み後、表示を開始する前に発生します。 ( Control から継承されます。) |
![]() | Unload | サーバー コントロールがメモリからアンロードされると発生します。 ( Control から継承されます。) |

TemplateControl クラス
アセンブリ: System.Web (system.web.dll 内)

Public MustInherit Class TemplateControl Inherits Control Implements INamingContainer, IFilterResolutionService
public ref class TemplateControl abstract : public Control, INamingContainer, IFilterResolutionService

TemplateControl クラスは、Page クラスと UserControl クラスに共通のプロパティとメソッドを提供する抽象クラスです。TemplateControl の新しいインスタンスを直接作成することはできません。

TemplateControl クラスから MyControl という名前のコントロールを派生させ、Construct メソッドをオーバーライドする方法を次のコード例に示します。MyControl が初期化されると、オーバーライドされた Construct メソッドが呼び出されます。
Imports System Imports System.Web Imports System.Web.UI Imports System.Web.UI.WebControls Imports System.Security.Permissions ' The custom user control class. <AspNetHostingPermission(SecurityAction.Demand, _ Level:=AspNetHostingPermissionLevel.Minimal)> _ Public Class MyControl Inherits UserControl ' Create a Message property and accessors. Private _message As String = Nothing Public Property Message() As String Get Return _message End Get Set _message = value End Set End Property ' Create an event for this user control and ' name it myControl. Public Event myControl As System.EventHandler ' Override the default constructor. Protected Overrides Sub Construct() ' Specify the handler, MyInit, to be called when the myControl event ' is raised by the OnInit method. AddHandler Me.myControl, AddressOf MyInit End Sub 'Construct Protected Overrides Sub OnInit(e As EventArgs) RaiseEvent myControl(Me, e) Response.Write("The OnInit() method is used to raise the Init event.") End Sub 'OnInit ' Use the MyInit handler to set the Message property value ' when this method is called. Sub MyInit(sender As Object, e As System.EventArgs) _message = "Hello World!" End Sub 'MyInit ' Write the value of the Message property when the control ' is rendered. Protected Overrides Sub Render(output As HtmlTextWriter) output.Write(("<br>Message :" & _message)) End Sub 'Render End Class 'MyControl
using System; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Security.Permissions; // The custom user control class. [AspNetHostingPermission(SecurityAction.Demand, Level=AspNetHostingPermissionLevel.Minimal)] public class MyControl:UserControl { // Create a Message property and accessors. private string _message = null; public string Message { get { return _message; } set { _message = value; } } // Create an event for this user control and // name it myControl. public event System.EventHandler myControl; // Override the default constructor. protected override void Construct() { // Specify the handler, MyInit, to be called when the myControl event // is raised by the OnInit method. this.myControl += new System.EventHandler(MyInit); } protected override void OnInit( EventArgs e) { myControl(this ,e); Response.Write("The OnInit() method is used to raise the Init event."); } // Use the MyInit handler to set the Message property value // when this method is called. void MyInit(object sender,System.EventArgs e) { _message = "Hello World!"; } // Write the value of the Message property when the control // is rendered. protected override void Render(HtmlTextWriter output) { output.Write("<br>Message :" + _message); } }


System.Web.UI.Control
System.Web.UI.TemplateControl
System.Web.UI.Page
System.Web.UI.UserControl


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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


TemplateControl コンストラクタ
アセンブリ: System.Web (system.web.dll 内)



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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


TemplateControl プロパティ



TemplateControl メソッド



名前 | 説明 | |
---|---|---|
![]() | System.Web.UI.IFilterResolutionService.CompareFilters | 指定された 2 つデバイス フィルタ間に親子関係があるかどうかを示す値を返します。 |
![]() | System.Web.UI.IFilterResolutionService.EvaluateFilter | 指定されたフィルタが現在のフィルタ オブジェクトの型であるかどうかを示すブール値を返します。 |

TemplateControl メンバ
Page クラスと UserControl クラスに、基本の機能セットを提供します。
TemplateControl データ型で公開されるメンバを以下の表に示します。






名前 | 説明 | |
---|---|---|
![]() | AbortTransaction | ユーザーがトランザクションを終了すると発生します。 |
![]() | CommitTransaction | トランザクションが完了すると発生します。 |
![]() | DataBinding | サーバー コントロールがデータ ソースに連結すると発生します。(Control から継承されます。) |
![]() | Disposed | サーバー コントロールがメモリから解放されると発生します。これは、ASP.NET ページが要求されている場合のサーバー コントロールの有効期間における最終段階です。(Control から継承されます。) |
![]() | Error | 未処理の例外がスローされると発生します。 |
![]() | Init | サーバー コントロールが初期化されると発生します。これは、サーバー コントロールの有効期間における最初の手順です。(Control から継承されます。) |
![]() | Load | サーバー コントロールが Page オブジェクトに読み込まれると発生します。(Control から継承されます。) |
![]() | PreRender | Control オブジェクトの読み込み後、表示を開始する前に発生します。(Control から継承されます。) |
![]() | Unload | サーバー コントロールがメモリからアンロードされると発生します。(Control から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | System.Web.UI.IFilterResolutionService.CompareFilters | 指定された 2 つデバイス フィルタ間に親子関係があるかどうかを示す値を返します。 |
![]() | System.Web.UI.IFilterResolutionService.EvaluateFilter | 指定されたフィルタが現在のフィルタ オブジェクトの型であるかどうかを示すブール値を返します。 |

- TemplateControlのページへのリンク