Saturday, May 18, 2013

ASP.NET Custom Control Lifecycle

November 1, 2009 by · Leave a Comment 

I always forget the lifecycle of custom server control classes with respect to web page, ie. aspx file.

The following results are based on a drop down list custom control:

customcontrol – Constructor
customcontrol – OnInit – Enter
customcontrol – OnInit – Exit
webpage – OnInit – Enter
webpage – OnInit – Exit
webpage – Page_Load – Enter
customcontrol – could be altered here in page load, causing some event to fire
webpage – Page_Load – Exit
customcontrol – OnLoad – Enter
customcontrol – OnLoad – Exit

POSTBACK:
customcontrol – Constructor
customcontrol – OnInit – Enter
customcontrol – OnInit – Exit
webpage – OnInit – Enter
webpage – OnInit – Exit
customcontrol – LoadViewState – Enter
customcontrol – LoadViewState – Exit
webpage – Page_Load – Enter
webpage – Page_Load – Exit
customcontrol – OnLoad – Enter
customcontrol – OnLoad – Exit

customcontrol – OnSelectedIndexChanged – Enter
webpage – xx_SelectedIndexChanged – Enter
customcontrol – could be altered here in page load, causing some event to fire
webpage – xx_SelectedIndexChanged – Exit
customcontrol – OnSelectedIndexChanged – Exit

Top Blogs

Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!

*