What is client startup script?

H

Harry Smith

While reading the documentation on IsStartupScriptRegistered, there is a
reference to "client startup script" as "Determines if the client startup
script is registered with the Page object."
What is meant by "Client Start Script"?
Thanks,
Harry
 
K

Kevin Spencer

It would help if you mentioned what documentation you were reading. I looked
up IsStartupScriptRegistered in the .Net SDK, and saw no reference to
"client startup script." I DID see a reference to "client-side script,"
which is a reference to JavaScript that is added to the client HTML
document. The IsStartupScriptRegistered() method can be called prior to
calling RegisterStartupScript(), in order to make sure that you aren't
reproducing the script in the Page. The RegisterStartupScript() method adds
a JavaScript which you define as a string to the Page's output.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living
 
H

Harry Smith

Kevin,
In have installed VS 2003. In the code window I have code like this.
If (Not aspxPage.IsStartupScriptRegistered(strKey)) Then
aspxPage.RegisterStartupScript(strKey, strScript)

End If

If I keep the cursore at IsStartupScriptRegistered and press F1, I am
getting this documentation in my help window.

Here is the URL
:ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfSystemWebUIP
ageClassIsStartupScriptRegisteredTopic.htm

Also on WWW the URL is
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
frlrfSystemWebUIPageClassIsStartupScriptRegisteredTopic.asp

I know you will have some answer to my question.

Thanks,

Harry
 
L

Lau Lei Cheong

In short, it is a client-side script(either vbscript or javascript) that
will be executed when the page is fully loaded.

Somehow equivalent to adding the script in form of function then added it to
"onload" of body tag.
 
B

bruce barker

not quite true. startup script is rendered as inline script just before the
</form>. this means it will fire after all controls have rendered but
before the onload event as the page has not been fully parsed yet.

when you write a cutom control that render javascript, you can use
IsStartupScriptRegistered to tell if the script has already been registered,
to handle the case when your control has mutiple instances on a page (then
only one has to do the register).

-- bruce (sqlwork.com)

| In short, it is a client-side script(either vbscript or javascript) that
| will be executed when the page is fully loaded.
|
| Somehow equivalent to adding the script in form of function then added it
to
| "onload" of body tag.
|
| "Harry Smith" <[email protected]> ¦b¶l¥ó
| ¤¤¼¶¼g...
| > While reading the documentation on IsStartupScriptRegistered, there is a
| > reference to "client startup script" as "Determines if the client
startup
| > script is registered with the Page object."
| > What is meant by "Client Start Script"?
| > Thanks,
| > Harry
| >
| >
|
|
 
K

Kevin Spencer

Well, Harry, in any case, the "client startup script" and the "client-side
script" are the same thing. It is a startup script because it is executed
when the Page loads. It's a client-side script because it executes on the
client.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living
 
H

Harry Smith

Kevin,
When the .ASPX is browsed the server sends the plain HTML page to the
browser. When "aspxPage.RegisterStartupScript" is used in a page where
exactly this will be used in the client side events? Which code will be
called when if I have code in onload event?
Thanks,
Harry
 
K

Kevin Spencer

Ah, no worries, Harry. RegisterStartupScript() puts the script just before
the </form> tag in the page. It is not attached to any Event Handler. Any
scripting that occurs in an HTML document which is not defined in a function
is executed immediately when the document loads (more precisely, when the
browsser parses it, which is why it is put just before the end of the form,
in case it references any form elements). IOW, you can also add an onload
event handler to the body tag, and it will execute as well.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.
 
H

Harry Smith

Kevin,
What is IOW ?
Harry


Kevin Spencer said:
Ah, no worries, Harry. RegisterStartupScript() puts the script just before
the </form> tag in the page. It is not attached to any Event Handler. Any
scripting that occurs in an HTML document which is not defined in a function
is executed immediately when the document loads (more precisely, when the
browsser parses it, which is why it is put just before the end of the form,
in case it references any form elements). IOW, you can also add an onload
event handler to the body tag, and it will execute as well.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Neither a follower
nor a lender be.


:ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfSystemWebUIP
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/ reading.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top