Event handlers in Page class

  • Thread starter Thread starter Bingo
  • Start date Start date
B

Bingo

Quick question,

I'm new to C# and ASP.NET.

Why do the OnInit, OnPreRender and other eventhandlers in the Page class
only have (Eventargs) as the only argument?

Isn't the signature of an event handler supposed to be (object, eventArgs)?

My only guess is that these aren't being assigned via a delegate, but
confirmation would be handy.

Cheers
 
Hi,
There is difference between event handler and overridden method.

OnInit, OnPreRender, OnLoad and other methods with only one (EventArgs)
argument are overridden methods.

// overridden method, that overrides method OnLoad of base class (Page)
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
}

// event handler
private void Page_Load(object sender,EventArgs e)
{
}

Tomas Petricek
Microsoft C# MVP

-----Original Message-----
From: Bingo [mailto:[email protected]]
Posted At: Monday, August 02, 2004 1:06 AM
Posted To: microsoft.public.dotnet.languages.csharp
Conversation: Event handlers in Page class
Subject: Event handlers in Page class

Quick question,

I'm new to C# and ASP.NET.

Why do the OnInit, OnPreRender and other eventhandlers in the Page class

only have (Eventargs) as the only argument?

Isn't the signature of an event handler supposed to be (object,
eventArgs)?

My only guess is that these aren't being assigned via a delegate, but
confirmation would be handy.

Cheers
 
Back
Top