Control.OnInit メソッド
アセンブリ: System.Web (system.web.dll 内)


このメソッドによって通知されると、サーバー コントロールはインスタンスを作成し、設定するために必要な初期化の手順を実行する必要があります。サーバー コントロールの有効期間のこの段階では、コントロールのビューステートを設定する必要があります。さらに、このメソッドを呼び出しているときは、このサーバー コントロールが子か親かにかかわらず、これ以外の他のサーバー コントロールにはアクセスできません。他のサーバー コントロールは、作成されていなかったり、アクセスの準備ができていなかったりする場合があります。

' Override the OnInit method to write text to the ' containing page if the _text property is null. <System.Security.Permissions.PermissionSetAttribute( _ System.Security.Permissions.SecurityAction.Demand, Name:="FullTrust")> _ Protected Overrides Sub OnInit(e As EventArgs) MyBase.OnInit(e) If _text Is Nothing Then _text = "Here is some default text." End If End Sub 'OnInit
// Override the OnInit method to write text to the // containing page if the _text property is null. [System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name="FullTrust")] protected override void OnInit(EventArgs e) { base.OnInit(e); if ( _text == null) _text = "Here is some default text."; }

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


- Control.OnInit メソッドのページへのリンク