473,463 Members | 1,495 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Get onload to occur first before Page_Load

Opa
Hi,

I have a form with a javacript function that I wish to call before the
Page_Load event on the server side. The function is called in the onload of
window (ie. window.onload = "myfunction()"

Is this possible? If so how, If not is there a workaround ?
Jun 13 '06 #1
2 3111
The javascript onload happens after the browser has loaded the HTML returned
by the server and parsed it.

In order for the server to return the HTML, it has to process the IIS
request, and then process the page. This involves calling the various page
events, including the Load event.

So, you see, without the HTML, there is no way to run any javascript events.

And without the Load event being fired (among many other things happening),
there is no way to get the HTML to the browser.

Consider the order of events that happen when you browser requests a page
from the server, and you will see that what you are asking for is not
possible and doesn't even really make sense in terms of how web applications
work.

"Opa" <Op*@discussions.microsoft.com> wrote in message
news:DE**********************************@microsof t.com...
Hi,

I have a form with a javacript function that I wish to call before the
Page_Load event on the server side. The function is called in the onload
of
window (ie. window.onload = "myfunction()"

Is this possible? If so how, If not is there a workaround ?

Jun 13 '06 #2
Opa
Yes, this is what I thought. The page is not fully rendered to the browser
an hence the javacript does not exist. I will work around the problem.
Thanks for your help.

"Marina Levit [MVP]" wrote:
The javascript onload happens after the browser has loaded the HTML returned
by the server and parsed it.

In order for the server to return the HTML, it has to process the IIS
request, and then process the page. This involves calling the various page
events, including the Load event.

So, you see, without the HTML, there is no way to run any javascript events.

And without the Load event being fired (among many other things happening),
there is no way to get the HTML to the browser.

Consider the order of events that happen when you browser requests a page
from the server, and you will see that what you are asking for is not
possible and doesn't even really make sense in terms of how web applications
work.

"Opa" <Op*@discussions.microsoft.com> wrote in message
news:DE**********************************@microsof t.com...
Hi,

I have a form with a javacript function that I wish to call before the
Page_Load event on the server side. The function is called in the onload
of
window (ie. window.onload = "myfunction()"

Is this possible? If so how, If not is there a workaround ?


Jun 13 '06 #3

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

Similar topics

2
by: laredotornado | last post by:
Hello, I am looking for a cross-browser way (Firefox 1+, IE 5.5+) to have my Javascript function execute from the BODY's "onload" method, but if there is already an onload method defined, I would...
3
by: Christian | last post by:
hi, what is the difference between the Page_Load() and OnLoad() event handlers. do they originate from a different point ?
2
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...
3
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...
3
by: Cc | last post by:
does event onload mean form already loaded or before loaded? I make a form and I inherit that form on another form, when I run, it execute the process on the parent form without showing the form on...
17
by: B. Chernick | last post by:
I'm trying to create a web page and I need a javascript function to be called on the load of a particular panel. (The panel is hidden during some but not all postbacks.) The function is bound...
6
by: RSH | last post by:
I have a situation where I am successfully adding an Onload to the Body tag from the codebehind from a page using the following code: Protected WithEvents body1 As...
4
by: Jason | last post by:
Hi, Here's the scenario: I have a web application that has window A and window B. A user has both window A and B open - window A is in the foreground and window B is behind it. If the...
3
by: zepdad | last post by:
I'm new to forum and am learning javascript. I appreciate your help and patience in advance. I run an image gallery website that uses an onload event called FitPic() to scale image and window sizes...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
1
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...
0
tracyyun
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.