Thursday, 20 March 2008
ASP.Net Page_XXX events
public void Page_Load(object sender, EventArgs e) {}
I had always assumed that the framework searched for these methods based on their full signature, turns out this isn't the case. The ASP.Net MVC framework uses a
public void Page_Load() {}
method, and I was trolling through the code trying to find where this is called from, when I ended up inside the Page ProcessRequest method, i.e. the default ASP.net processing. Which meant there was no special processing for this version of Page_Load.
I quickly create a bog standard web app and added a no parameter Page_Load to it, and sure enough it fires!
Note that if you have the parameterised and no parameter Page_Load only the parameterised one is called.
Posted by at 10:03 AM in Net
