Page_Load event is called every time a page is loaded is the
documentation saying.
I just wonder what exactly does this mean ?
It means it is called every time a page is loaded, which means every
time there is a Request from a browser.
Realistically, the pattern is:
protected void Page_Load(object sender, EventArgs e)
{
if(!Page.IsPostBack)
{
//Stuff when the page is initially loaded (GET)
}
else
{
//Stuff that runs on 100% of Postbacks (POST)
//Generally, you put code in event handlers
//not here. If you find yourself coding here
//you are probably using bad architecture.
}
}
There are other events that run every time the page is requested. NOTE:
Page_Load is for loading pages. It applies to all pages. If you have
event handlers, put conditionals there.
Peace and Grace,
--
Gregory A. Beamer (MVP)
Twitter: @gbworld
Blog:
http://gregorybeamer.spaces.live.com
*******************************************
| Think outside the box! |
*******************************************