Re: What is function pageLoad()

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



I like #1 better than the way I did it in the constructor.
Thanks

"George" <noemail@xxxxxxxxxxx> wrote in message
news:udznJVwhJHA.4372@xxxxxxxxxxxxxxxxxxxxxxx
You correct in that you need to wire up your events.

with C# you have 3 options.

1 (best). override OnLoad method of the base Page class.
so it looks like this
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
...your code here
}

Plus: somewhat faster and convenient sine it's less code
Minus: Method must be named OnLoad

2 (ok). Wire up it to Page.Load event
Load += Page_Load;

Plus: You can name your method anything you want and you can wire up many
different methods.
Minus: You need to no forget write that line of code

3(worst). Use AutoEventWireup = true.
This is worst since it's using reflection to find all available methods on
a form and wire them up as in #2. but wasting a lot of runtime.

My advice: Always keep AutoEventWireup = false and use #1 method.

George.


"AAaron123" <aaaron123@xxxxxxxxxxxxxx> wrote in message
news:eqUHnLuhJHA.760@xxxxxxxxxxxxxxxxxxxxxxx
I just got back to this.

I have an aspx file that contains AutoEventWireup="false"
If I double click in the design mode it open the .cs file pointing to the
public void Page_Load method.



But when I run in debug mode that method is not called.

So I add a constructor:

public FileForm()

{

this.Load += Page_Load;

}

And Page_Load does run.

So it appears that with AutoEventWireup="false"
and c# I need to register Page_load in the constructor.

Is that your understanding??

Also for other methods like Page_Unload?



Thanks




"AAaron123" <aaaron123@xxxxxxxxxxxxxx> wrote in message
news:OyrV5FZfJHA.5496@xxxxxxxxxxxxxxxxxxxxxxx
Just one more time because I think my experience shows the Page_Load
event does not fire if AutoEventWireup="false".

If I'm correct then I don't know the format to register the event and
don't know where to put the register command.

Thanks

PS I'll check again to see if the event fires




"Cowboy (Gregory A. Beamer)" <NoSpamMgbworld@xxxxxxxxxxxxxxxxxx> wrote
in message news:uO5VCnWfJHA.3708@xxxxxxxxxxxxxxxxxxxxxxx
With the standard events you do not need to go through the hoops of
registration, as it is done for you. For other event handlers, you do
have to connect them, either declaratively or with the ??? += ???
format.

--
Gregory A. Beamer
MVP; MCP: +I, Se, SD, DBA

Blog:
http://feeds.feedburner.com/GregoryBeamer

*************************************************
| Think outside the box! |
*************************************************
"AAaron123" <aaaron123@xxxxxxxxxxxxxx> wrote in message
news:%23vPBTtKfJHA.5244@xxxxxxxxxxxxxxxxxxxxxxx
I have a question about Page_Load. If I have AutoEventWireup="false"

for the Page_Load event to be raised in C# don't I have to register
the event?

I'm not sure "register" is the correct word, but it seems I remember a
statement, something like:

??? += ???

If so where do I put the statement?

Thanks a lot

"Cowboy (Gregory A. Beamer)" <NoSpamMgbworld@xxxxxxxxxxxxxxxxxx> wrote
in message news:uXfu26JfJHA.3792@xxxxxxxxxxxxxxxxxxxxxxx
It is a function name built into AJAX to make things simpler for you
to load client side variables when you are using AJAX. There is also
a pageUnload, if you need clean up. In most cases, these routines are
not taken advantage of by developers. I have, however, seen it used
to load Silverlight, which is a bit creative.

When the page is compiled, the pageLoad event gets wired up to
Sys.Application.Load. This is very similar to how Page_Load is wired
to Page.Load in ASP.NET code.

--
Gregory A. Beamer
MVP; MCP: +I, Se, SD, DBA

Blog:
http://feeds.feedburner.com/GregoryBeamer

*************************************************
| Think outside the box! |
*************************************************
"AAaron123" <aaaron123@xxxxxxxxxxxxxx> wrote in message
news:%23N%23uyk$eJHA.5316@xxxxxxxxxxxxxxxxxxxxxxx
I got from ms an .aspx file that contains a pageLoad() JavaScript
function

I put an alert in it and I can see that it does run.

What calls it?

It is not referenced in the code, but it does execute.

Is it a page load event that is automatically wired as a client side
event?

If so, are there other such events.

Google and VS Help give many hits but they seem to relate to
Page.Load or the words "page load"



So, I copied into another .aspx file and it does NOT execute.

They both have AutoEventWireup="false" and are both content files
for the same master.



Why does it work in one but not the other?



Thanks

















.



Relevant Pages

  • Re: What is function pageLoad()
    ... If I double click in the design mode it open the .cs file pointing to the ... and c# I need to register Page_load in the constructor. ... load client side variables when you are using AJAX. ... I copied into another .aspx file and it does NOT execute. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: What is function pageLoad()
    ... You correct in that you need to wire up your events. ... If I'm correct then I don't know the format to register the event and don't know where to put the register command. ... I have, however, seen it used to load Silverlight, which is a bit creative. ... I copied into another .aspx file and it does NOT execute. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: What is function pageLoad()
    ... for the Page_Load event to be raised in C# don't I have to register the ... I'm not sure "register" is the correct word, but it seems I remember a ... load client side variables when you are using AJAX. ... I copied into another .aspx file and it does NOT execute. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: What is function pageLoad()
    ... for the Page_Load event to be raised in C# don't I have to register the ... load client side variables when you are using AJAX. ... I copied into another .aspx file and it does NOT execute. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Antii, can you give us an update?
    ... 2:1 MUX for the selecting the load value ... input of mux connected to 24 bit shift register in A2 domain ... that load the load enable signal is FULLY DISABLED ... clock domains; with purely combinational logic ...
    (comp.arch.fpga)