In "Beginning ASP.NET using C#", pages 257 - 262 talk about the Page_Init
and Page_Load events, and give an example. In the example, a global
variable is incremented when the page is intialised and again when it's
loaded, so the first time the page is loaded the variable is 2 (+1 in
Page_Init and +1 in Page_Load). When the page is reloaded, the variable
remains at 2 and the text explains that this is because the variable is
not persisted and so is re-initialised each time the page is loaded.
My question is, why is the variable 2, and not 1? If the variable is
initialised, and Page_Init is not called (as is proved by output from the
script), the variable should only be incremented once, during Page_Load.
One thing I should mention...I haven't actually physically run this
example as I'm at work and only have the SDK at home. Therefore I'm going
on output printed in the book, which I guess could be wrong.
Apologies for the long post, and thanks in advance for any help.
Gerry Crowe