In an interview question today, I was asked which is the last event in page life cycle where you can set the control’s properties. I said it will be the event (eg. button click etc) or if there is no event then set it in page load event. Then he said I want the last event name.
Which is the last event to update control’s properties and why would one use such an event? and not page load or button click etc?
I would say its the PreRenderComplete event, since the page is rendered immediately afterwards
Although looking at the MSDN page lifecyle, the SaveStateComplete event happens even after that. Though if you were to use that you wouldn’t be able to save the control’s new properties to the ViewState.
In practice personally I would use the PreRender event to do ‘final’ control changes.