Is there a way to execute a JavaScript from the Page_Load event?
Or alternatively, is there a way to have it execute when the page is loaded?
I am defining the script in the Page_Load event and using the
RegisterStartup Function to add it to the page. I just need a way to execute
the script when the page loads.
Any ideas?
Thanks in advance,
Scott 5 4931
Look into using the body onload event. This JavaScript event will be fired
once the complete file is sent to the user.
HTH MikeL
"Scott Natwick" wrote: Is there a way to execute a JavaScript from the Page_Load event?
Or alternatively, is there a way to have it execute when the page is loaded?
I am defining the script in the Page_Load event and using the RegisterStartup Function to add it to the page. I just need a way to execute the script when the page loads.
Any ideas?
Thanks in advance, Scott
Thanks, Mike.
I appreciate the response.
I tried triggering the function from the "onload" event of the "body," like
you suggested.
However, the message I get is " undefined:NaN". I think maybe the timing is
off or somthing?
If I add a button to the page and have the button call the function, it
works.
Any thoughts on this?
Thanks again,
Scott
"MikeL" <Mi***@discussi ons.microsoft.c om> wrote in message
news:22******** *************** ***********@mic rosoft.com... Look into using the body onload event. This JavaScript event will be fired once the complete file is sent to the user.
HTH MikeL
"Scott Natwick" wrote:
Is there a way to execute a JavaScript from the Page_Load event?
Or alternatively, is there a way to have it execute when the page is loaded?
I am defining the script in the Page_Load event and using the RegisterStartup Function to add it to the page. I just need a way to execute the script when the page loads.
Any ideas?
Thanks in advance, Scott
Thanks for the response, Mike.
I tried what you suggest. I added the function call to the "onload" event
of the "body."
However, I received the message " undefined:NaN" as a result of the function
call.
I think maybe the timing may be off?
If I trigger the function call from a button, once the page is loaded, it
works.
Any thoughts?
Thanks again,
Scott
"MikeL" <Mi***@discussi ons.microsoft.c om> wrote in message
news:22******** *************** ***********@mic rosoft.com... Look into using the body onload event. This JavaScript event will be fired once the complete file is sent to the user.
HTH MikeL
"Scott Natwick" wrote:
Is there a way to execute a JavaScript from the Page_Load event?
Or alternatively, is there a way to have it execute when the page is loaded?
I am defining the script in the Page_Load event and using the RegisterStartup Function to add it to the page. I just need a way to execute the script when the page loads.
Any ideas?
Thanks in advance, Scott
Scott,
It sounds like the JavaScript function is not being loaded onto the page
before the body tag. To see if this is happening save the page as HTML and
open it up in IE. It it works then, then it is a load problem. Try
registering the script in the page load event.
HTH MikeL
"Scott Natwick" wrote: Thanks for the response, Mike.
I tried what you suggest. I added the function call to the "onload" event of the "body."
However, I received the message " undefined:NaN" as a result of the function call.
I think maybe the timing may be off?
If I trigger the function call from a button, once the page is loaded, it works.
Any thoughts?
Thanks again, Scott
"MikeL" <Mi***@discussi ons.microsoft.c om> wrote in message news:22******** *************** ***********@mic rosoft.com... Look into using the body onload event. This JavaScript event will be fired once the complete file is sent to the user.
HTH MikeL
"Scott Natwick" wrote:
Is there a way to execute a JavaScript from the Page_Load event?
Or alternatively, is there a way to have it execute when the page is loaded?
I am defining the script in the Page_Load event and using the RegisterStartup Function to add it to the page. I just need a way to execute the script when the page loads.
Any ideas?
Thanks in advance, Scott
Mike,
Thanks very much for your help. You nailed it! It's working now.
Scott
"MikeL" <Mi***@discussi ons.microsoft.c om> wrote in message
news:38******** *************** ***********@mic rosoft.com... Scott,
It sounds like the JavaScript function is not being loaded onto the page before the body tag. To see if this is happening save the page as HTML and open it up in IE. It it works then, then it is a load problem. Try registering the script in the page load event.
HTH MikeL
"Scott Natwick" wrote:
Thanks for the response, Mike.
I tried what you suggest. I added the function call to the "onload" event of the "body."
However, I received the message " undefined:NaN" as a result of the function call.
I think maybe the timing may be off?
If I trigger the function call from a button, once the page is loaded, it works.
Any thoughts?
Thanks again, Scott
"MikeL" <Mi***@discussi ons.microsoft.c om> wrote in message news:22******** *************** ***********@mic rosoft.com... > Look into using the body onload event. This JavaScript event will be > fired > once the complete file is sent to the user. > > HTH MikeL > > "Scott Natwick" wrote: > >> Is there a way to execute a JavaScript from the Page_Load event? >> >> Or alternatively, is there a way to have it execute when the page is >> loaded? >> >> I am defining the script in the Page_Load event and using the >> RegisterStartup Function to add it to the page. I just need a way to >> execute >> the script when the page loads. >> >> Any ideas? >> >> Thanks in advance, >> Scott >> >> >> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Jim Hammond |
last post by:
The script function in the code below works fine when it is JavaScript, but
when I try to use C#, the function doesn't get executed.
<body MS_POSITIONING="GridLayout">
<form id="Form1" name="Form1" method="post"
encType="multipart/form-data" runat="server" VIEWASTEXT>
<asp:button id="Button3" runat="server" Text="TAKE PHOTO"></asp:button>
</form>
|
by: Michael SL |
last post by:
Here is my problem. I have a delete record button. I want to prompt the user "Do you really want to delete?". If the user clicks 'OK' then I want to execute the CodeBehind on the server side to accomplish this. How do I do this
I think the HtmlButton is probably the desired method. But, how do I get the client side javascript to execute the desired (when needed) the server side codebehind function?
|
by: Julia |
last post by:
Hi Everyone,
I am using webbrowser control to post data to an aspx page. However, for
some reason, the aspx page sometimes will execute page_load event twice, and
sometimes execute it once. So I might get different results for executing it.
If I have the webbrwoser control to call it the first time, the aspx will
usually execute the page_load twice.
What can be the problem?
|
by: Brian Miller |
last post by:
I've been constructing an ASP.Net application using the 1.1 framework,
and have been using Web Matrix for development purposes. Now that my
application is near completion, I wanted to see if I can set up my
pages for access directly via localhost (not using the WebMatrix
server). My login page loads, and any validation controls on the page
work fine, so I know it's recognizing the ASP.Net code there, however,
when I try to log on, the...
|
by: Ian Kelly |
last post by:
Hi All,
I have an .net form that is split into two frames. The left frame has a
tree that displays a list of all the customers. The right frame displays
the appropriate clients information. When the save button is pressed on the
right frame, I want to update the tree in the left frame AFTER saving all
the data as the changes to the right frame may affect how the tree is
displayed. I tried using the following:
...
| |
by: Mark Miller |
last post by:
I've been trying to execute a javascript function just before submit on a
form that contains an <input type="file"> input field and it isn't working.
The reason I want to do this is the end users will be uploading files that
are between 1 and 2 Meg. in size, and they are not too knowledgeable about
computers. I want to disable the form buttons so they can't hit them after
they hit the "upload" button. We're trying to prevent them from...
|
by: Edwin Knoppert |
last post by:
I post this again, no answer before.
During the beta version it worked, the same code does no longer work in the
new release.
I have a simple gridview with ButtonField, the button deletes a records.
So i want to add a confirm in javascript.
How will i set the javascript function (OnClientClick) for this ButtonField?
|
by: anadimpa |
last post by:
Hello all
I build a javascript function string in the code behind and register it in
the Page_Load of my User Control. I do this because I build the javascript
based on some variables that are passed to this user control.
How do I (or from where do I) call this function?
I tried several ways like:
this.Attributes.Add("onLoad", "javascript:openDoc();");
in the page_load / page_prerender etc...
|
by: Ben |
last post by:
Hi,
When a user wants to start the application, aspnet checks a boolean value in
a field of the database.
If that value is 'false', then i want to execute a ALERT in javascript
telling the applicatin is closed.
This is a part of the .aspx.vb file:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load
....
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |