Prev | Current Page 337 | Next

Rob Cameron and Dale Michalk

"Pro ASP.NET 3.5 Server Controls and AJAX Components"

WriteLine(info);
}
This class method also sends output to the debug stream via the System.Diagnostics.
Debug class and its WriteLine method. The reason for this extra step is to view Unload and
Dispose event execution, which occurs after the web form is finished writing out its content via
the Render method and the ASP.NET trace tables have been generated. You can view debug
stream information in the Output window of Visual Studio when debugging.
The Init event is an opportunity for the control to initialize any resources it needs to
service the page request. A control can access any child controls in this method if necessary;
however, peer- and parent-level controls are not guaranteed to be accessible at this point in
the life cycle.
Overriding methods such as OnInit from the base class System.Web.UI.Control requires
that we call the base version of this method to ensure proper functioning of the event. The base
class implementation of OnInit actually raises the Init event exposed by the root Control class
to clients.
If you override OnInit but do not call the base class version of this event, the event will not
be raised to clients that are registered to receive it. This applies to the other On-prefixed methods
such as OnLoad, OnPreRender, and OnUnload, which are part of the life cycle process, as well as
other non-life-cycle-specific event methods such as OnDataBinding and OnBubbleEvent.


Pages:
325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349