p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Beginning ASP.NET 4.5 : in C# and VB (http://p2p.wrox.com/forumdisplay.php?f=710)
-   -   Chapter 2, possible errata - Page_Load event in code behind (http://p2p.wrox.com/showthread.php?t=90567)

WebDev123 July 21st, 2013 12:36 AM

Chapter 2, possible errata - Page_Load event in code behind
 
On page 50, step#5 there may be a conceptual misstatement. Here it says that the code "fires when the page loads in the browser." I don't know this is technically correct.

This code fires when the page loads on the server, BEFORE it gets sent to the browser. After it gets processed on the server and transformed into HTML, it gets sent to the client, at which time the HTML page actually loads in the browser.

An example of an event that actually fires upon loading in the client browser would be the JavaScript event called window.onload.

WebDev123 July 21st, 2013 12:46 AM

By the way, I'm not trying to be nit picky. Rather, these small details are so crucial. You hear people describing things like this a lot, but it's so important to clarify these concepts and keep them straight (details like this can make all the difference in the world, from a programming perspective - as you know). The challenge to web programming, like most anything, isn't so much the tools or clicks, but the concepts and understanding exactly what's occuring from a logical step by step standpoint.

Oleg Kolpashchikov July 25th, 2013 06:38 PM

Page_Load event handler
 
This must be a mistake in the book - Page_Load event has nothing to do with the browser, it is a server side event and the word "load" refers to ASP.NET server controls:
<asp:Label ID="Label1" runat="server" />
At this point in the page life cycle the server controls are "loaded", their state is reconstructed from the viewstate, you can do something to them in the code that runs within this handler:

Code:

protected void Page_Load(object sender, EventArgs e)
{ // code that fires on the server
    Label1.Text = "We can put a new text here";
}

e.g. "Text"-property of the Label control with ID of "Label1" can be changed to something else.

Imar July 30th, 2013 02:00 PM

Quote:

Rather, these small details are so crucial.
I agree. I should have worded it differently. Since it's an introductory chapter I wanted to keep things simple, and this issue slipped through. Later chapters dig much deeper in how this works, and when pages are processed and which events they raise.

Cheers,

Imar


All times are GMT -4. The time now is 11:18 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.