I need some guidelines about building the code behind of my pages correctly. I mean, I’m building in asp.net for a year now, and mostly using the Page_Load event. (and ofcourse “event handling” the events triggered by the user’s actions). I know about the page life cycle and the order of events that happens when a page is requested etc.. . Is it normal that, generally, in a data-driven page, for example, I’m not using any of the “pre_render”, “page_unload”, “pre_init” etc.. event handlers? or am I missing something here? any guidelines would help me a lot, including links or whatever you think that would instruct me well. thanks.
Share
You are not missing anything.
Most asp.net code does not use these events, and you should only be using the handlers if you need to.
For example – if you really need to change the output of the page after all control event handlers (for example button clicks) have fired, use the
pre_renderevent. In my experience this is a rare thing to need.Many of the event are there just in case you need them.