Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > OnInit and Page_Init

Reply
Thread Tools

OnInit and Page_Init

 
 
=?Utf-8?B?cm9kY2hhcg==?=
Guest
Posts: n/a
 
      10-29-2007
hey all,
Is OnInit and Page_Init the same thing?

thanks,
rodchar
 
Reply With Quote
 
 
 
 
Peter Bucher [MVP]
Guest
Posts: n/a
 
      10-30-2007
Hello Rodchar

> Is OnInit and Page_Init the same thing?

There are 3 different things.

"Init" is the event
"OnInit" is the method that raises the "Init" event
"Page_Init" (Or some else name) is the name of the eventhandler that is
attached to an (typically Init) event

If you want to handle the event, you can:

1. Wire up the Init Event and handle the event in a eventhanler methode (for
example: Page_Init)
2. Overwrite the "OnInit" method and implement some logic in there,
additionaly you can (or in some cases should) call the base.OnInit()
method, otherwise the implementation of the base class would`t run.

--
Gruss, Peter Bucher
Microsoft MVP - Visual Developer ASP / ASP.NET, Switzerland
http://www.aspnetzone.de/ - ASP.NET Zone, die ASP.NET Community
http://www.aspnetzone.de/blogs/peterbucher/ - Auf den Spuren von .NET


 
Reply With Quote
 
 
 
 
=?Utf-8?B?cm9kY2hhcg==?=
Guest
Posts: n/a
 
      10-30-2007
Thank you Peter for the insight.
Rod.

"Peter Bucher [MVP]" wrote:

> Hello Rodchar
>
> > Is OnInit and Page_Init the same thing?

> There are 3 different things.
>
> "Init" is the event
> "OnInit" is the method that raises the "Init" event
> "Page_Init" (Or some else name) is the name of the eventhandler that is
> attached to an (typically Init) event
>
> If you want to handle the event, you can:
>
> 1. Wire up the Init Event and handle the event in a eventhanler methode (for
> example: Page_Init)
> 2. Overwrite the "OnInit" method and implement some logic in there,
> additionaly you can (or in some cases should) call the base.OnInit()
> method, otherwise the implementation of the base class would`t run.
>
> --
> Gruss, Peter Bucher
> Microsoft MVP - Visual Developer ASP / ASP.NET, Switzerland
> http://www.aspnetzone.de/ - ASP.NET Zone, die ASP.NET Community
> http://www.aspnetzone.de/blogs/peterbucher/ - Auf den Spuren von .NET
>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Should I use Page_Init or OnInit method. harry potter ASP .Net 1 02-07-2006 04:13 AM
When Page.OnInit is done and exited, can I be sure that ALL child controls have called OnInit as well? Sally ASP .Net 1 04-15-2004 01:15 AM
Using inheritance for web pages - why have a Page_Init when you can override OnInit? ASP .Net 2 07-16-2003 07:32 PM
Page_Init() and Page_Load() Christian ASP .Net 1 07-16-2003 07:28 PM
Using inheritance for web pages - why have a Page_Init when you can override OnInit? ASP .Net 2 07-13-2003 04:07 AM



Advertisments