wireup Page_Load programmatically in ASP.NET 2.0

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is it possible to wire up the Page_Load event in ASP.NET 2.0 programmatically
if I set my AutoWireUp=false
 
Duh! A little more thought and I answered it on my own.

If I have a Page directive such as the following where the
AutoEventWireup="false", I'd need to hoook up my own event handlers in the
constructor.

<%@ Page Language="C#" Trace="false" AutoEventWireup="false"
CodeFile="Default.aspx.cs" Inherits="_Default" %>

So, if my codebehind class was _Default, I'd need to create a constructor
for it, such as:

public _Default()
{
this.Load += new System.EventHandler(this._Page_Load);
}

Thanks
 
Back
Top