What exactly happens when a Page_Load event is triggered in ASP.NET ?
Posted on 2002-05-17
In ASP.NET you code for the Page_Load sub insite a <SCRIPT> block whose "runat" property is set to 'server'.
This means that the <SCRIPT> block will be processed at the server end. But the Page_Load event is fired when the ASP.NET page loads into the browser, so that would be a <<< client-side event >>, if I've understood that correctly.
So if I have for eg. a label control on my page to which I set some value in the Page_Load sub, then who exactly is setting the value of the label control ? The client or the server.
If it is the server then my query is, does the client notify the server in some way when the Page_Load event has occurred at the client end and consequently, the server during the page loading process itself, sets the value of the label.
On the otherhand, if it were the client that sets the value of label control during page load, how is that possible ? Coz once the page is sent to the clien by the server, that's the end of story. Meaning one full cycle of client-server interaction is over and the server will won't do anything until the next request is initiated from the cleint end or the browser.
So what exactly is the mechanism at work ?
The confusion in my mind is more with respect the text I have bracketed in angle brackets above. So who exactly does the job of setting the value of the label control and how ?