Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   OnInit and Page_Init (http://www.velocityreviews.com/forums/t547826-oninit-and-page_init.html)

=?Utf-8?B?cm9kY2hhcg==?= 10-29-2007 05:00 PM

OnInit and Page_Init
 
hey all,
Is OnInit and Page_Init the same thing?

thanks,
rodchar

Peter Bucher [MVP] 10-30-2007 08:45 AM

Re: OnInit and Page_Init
 
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



=?Utf-8?B?cm9kY2hhcg==?= 10-30-2007 12:34 PM

Re: OnInit and Page_Init
 
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
>
>
>



All times are GMT. The time now is 02:16 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.