asp.net.ph

Control.Init Event

System.Web.UI Namespace   Control Class


Occurs when the control is initialized, the first step in the page lifecycle.

[ VB ]
Public Event Init As EventHandler

[ C# ]
public event EventHandler Init;

[ C++ ]
public: __event EventHandler* Init;

In [ JScript ], you can handle the events defined by a class, but you cannot define your own.

Event Data

The event handler receives an EventArgs containing data related to the Init event.

Remarks

Server controls should perform any initialization steps that are required to create and set up an instance. You cannot use view-state information within this event; it is not populated yet. You should not access another server control during this event, regardless of whether it is a child or parent to this control. Other server controls are not certain to be created and ready for access.

Example

The following example demonstrates a handler for the Init event.

void Page_Init ( object sender,EventArgs e ) {
   // add an event Handler for 'Init'.
   myControl.Init += new System.EventHandler ( Control_Init );
}

void Control_Init ( object sender,EventArgs e ) { 
   Response.Write ( "The ID of the object initially : " + myControl.ID );      
   // change the ID property.
   myControl.ID="TestControl";
   Response.Write ( "<br>The changed ID : " + myControl.ID );
}
  C# VB

See Also

Control Members   BaseControlBuilder Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph