473,387 Members | 1,388 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

OnInit and Page_Init

hey all,
Is OnInit and Page_Init the same thing?

thanks,
rodchar
Oct 29 '07 #1
2 4211
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
Oct 30 '07 #2
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
Oct 30 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: | last post by:
I'm trying to better understand the use of inheritance vs. the implementation of a handler. I wanted to ask this question to the newsgroup. Each aspx page is a class which Inherits...
8
by: Invalidlastname | last post by:
Hi, We are developing an asp.net application, and we dynamically created certain literal controls to represent some read-only text for certain editable controls. However, recently we found an issue...
1
by: Sally | last post by:
Just confused about when OnInit and Constructor gets called in the parent/child case. Page.Constructor() Page.AddParsedSubObject() <- do all the sub's constructors get called here?...
1
by: tatemononai | last post by:
I've got a asp.net page that is derived off a custom class. The base class does some init stuff in OnInit that is needed by the derived pages. I'm having a timing problem with OnInit. The OnInit...
10
by: Wylbur via DotNetMonster.com | last post by:
Hello to all of you geniuses, I'm having a problem trying to get an Init handler to fire for a Placeholder control at the initialization phase. I’ve posted this problem to 3 other ASP.NET...
12
by: Nathan Sokalski | last post by:
What is the difference between the Page_Init and Page_Load events? When I was debugging my code, they both seemed to get triggered on every postback. I am assuming that there is some difference,...
1
by: harry potter | last post by:
Hi, Are there any reasons to use OnInit or Page_Init method to invoke some code when the Init event is triggered, if at all. Or are they both just the same? -S.
3
by: Beavis | last post by:
I hate to repost a message, but I am still at the same point where I was when I originally posted, and hopefully someone else will see this one... Ok, so I have gone off and documented the...
5
by: tshad | last post by:
I have a PageInit.ascx that I want to put in all my pages and have it execute only once during the "not IsPostback" section. I also need it to execute first before anything else. I have it set...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.