When you create a new web user control in visual studio it by default adds the Page_Load event. What is the advantage to using this rather than overriding the base OnLoad
event on the control? Is it just that the Page_Load
event fires before OnLoad
?
The OnLoad
method should be the place where the Load
event is raised. I personally always try to handle the event unless I need to do extra processing around raising the event.
I recommend handling the event itself under normal circumstances.
You may find this article on the page lifecycle from Microsoft useful.
As you can see above, it does mostly come down to personal choice IF that choice is made knowledgeably. The best quick but solid overview I've seen is at http://weblogs.asp.net/infinitiesloop/archive/2008/03/24/onload-vs-page-load-vs-load-event.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With