hi,
what is the difference between the Page_Load() and OnLoad() event handlers.
do they originate from a different point ? 3 9666
OnLoad is a protected method that is raised by the Load
event. I believe this method then calls Page_Load().
Tu-Thach -----Original Message----- hi,
what is the difference between the Page_Load() and OnLoad
() event handlers.do they originate from a different point ? .
the strange thing though is that when I implement both functions only
OnLoad()
is invoked and Page_Load() never is ???
same as with OnInit() and Page_Init()
christian
"Nikolaus Hruska" <nh*****@nist.gov> wrote in message
news:O8**************@TK2MSFTNGP11.phx.gbl... Onload raises the Load event.
if you want to selectively fire the Load event, override OnLoad, and check the necessary conditions.
ex:
Protected Sub OnLoad(sender as object, e as eventargs)
'only fire load event if condition is met If myCondition = True Then MyBase.OnLoad() End If End Sub
-- Nikolaus R. Hruska AASHTO Materials Reference Laboratory National Institute of Standards and Technology http://amrl.net nh*****@amrl.net "Rob Epstein" <re******@auctionworks.com> wrote in message news:eY**************@TK2MSFTNGP10.phx.gbl... Christian,
Page_Load() is a private function created by VS.NET that it then ties to the OnLoad event of the Page class in the InitializeComponents function. As I understand it, there is no need for this step since OnLoad is a protected function in the Page class that can be overriden. Just make sure you call the base OnLoad function in your overloaded version.
Rob Epstein Sr Developer, AuctionWorks Inc.
Christian wrote: hi,
what is the difference between the Page_Load() and OnLoad() event handlers. do they originate from a different point ?
"Christian" <ch***************@pandora.be> wrote in message
news:G4******************@afrodite.telenet-ops.be... the strange thing though is that when I implement both functions only OnLoad() is invoked and Page_Load() never is ???
The Page_Load() event handler needs to be added to the Load event of the
page class. If you're using VS.NET the IDE normally adds code that does
this for you at page init time in an override of the OnInit() method (it's
in a region of code marked with a "#region Web Form Designer generated code"
directive).
Another possible problem is that your override of the OnLoad() method is not
calling base.OnLoad() which is where the event handers registered in the
Load event will be called. same as with OnInit() and Page_Init()
christian
"Nikolaus Hruska" <nh*****@nist.gov> wrote in message news:O8**************@TK2MSFTNGP11.phx.gbl... Onload raises the Load event.
if you want to selectively fire the Load event, override OnLoad, and
check the necessary conditions.
ex:
Protected Sub OnLoad(sender as object, e as eventargs)
'only fire load event if condition is met If myCondition = True Then MyBase.OnLoad() End If End Sub
-- Nikolaus R. Hruska AASHTO Materials Reference Laboratory National Institute of Standards and Technology http://amrl.net nh*****@amrl.net "Rob Epstein" <re******@auctionworks.com> wrote in message news:eY**************@TK2MSFTNGP10.phx.gbl... Christian,
Page_Load() is a private function created by VS.NET that it then ties
to the OnLoad event of the Page class in the InitializeComponents
function. As I understand it, there is no need for this step since OnLoad is a protected function in the Page class that can be overriden. Just make sure you call the base OnLoad function in your overloaded version.
Rob Epstein Sr Developer, AuctionWorks Inc.
Christian wrote: > hi, > > what is the difference between the Page_Load() and OnLoad() event handlers. > do they originate from a different point ? > > >
--
MikeB This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: z. f. |
last post by:
Hi,
i have a class that is derived from System.Web.UI.Page, and this is the
class i use in my application as PageBase.
all other page classes are deriverd from my PageBase instead of the...
|
by: Stevie_mac |
last post by:
It might be me but...
I dont seem to get a Page_Load event when a opening an ASPX in an iFrame. I
do geta Page_Load event when an item on the ASPX (inside the iFrame) is
clicked but then...
|
by: foldface |
last post by:
Hi
I am aware of how Page_Load and OnLoad work. What I am curious about is
-why- there are 2 mechanisms for doing the same thing, in particular why
Visual Studio will generate code to implement...
|
by: RAJ |
last post by:
This event appears to be invoked twice for absolutely no reason on only one
of my ASP.Net web user controls. Although I've now overcome the problem by
overriding the base classes OnLoad routine, I...
|
by: RAJ |
last post by:
Posting this thread again, can somebody please help me with this. Thanks.
This event appears to be invoked twice for absolutely no reason on only one
of my ASP.Net web user controls. Although...
|
by: V. Jenks |
last post by:
I'm a little rusty having not touched .NET for 6 months and
I can't remember why Page_Load is happening twice in this code:
private void Page_Load(object sender, System.EventArgs e)
{...
|
by: doobdave |
last post by:
Hi all,
I'm experiencing a rather strange problem:
I am coding a web application using VB.net ASP.net and Visual Studio
2003.
It's quite a large application, but the problem only occurs on...
|
by: Dave |
last post by:
Hi, this is a follow-up to an earlier question but I really haven't found a
definitive answer in my search
If I have a Base and Derived webform, I've found that the dervived Page_Load
event...
|
by: lbolognini |
last post by:
Hi everybody,
sorry for the newbie question but I can't get the difference between
these two code snippets. Is it that one is a delegate (the first) and
that while the first ADDS behaviour the...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
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: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |