473,480 Members | 1,498 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

RegisterStartupScript

Hi,
Could you tell me about what is RegisterStartupScript, I try to understand
from MSDN sample, but I still don't understand. Could you give me more
simple sample ? and what is the purpose of RegisterStartupScript.
Thanks,

Nov 18 '05 #1
3 8246
There's an example in an article that I wrote some time ago:

http://www.ftponline.com/vsm/2002_07...net/page5.aspx
RegisterArrayDeclaration Inserts an array declaration into the HTML code,
including the <script> tags. Accepts both the array name and a
comma-separated list of values as a string.

RegisterClientScriptBlock Inserts a block of client-side code within the
HTML form. The first parameter is an identifying name for the block as a
string. The second parameter is a string containing the script to be sent to
the client. You must include the <script> tags.

RegisterHiddenField Inserts a hidden input field with the HTML form. The
first parameter is a string that provides the input control's name. The
second parameter, also a string, is the field's initial value. In the
rendered content, this field appears just before ASP.NET's hidden
"__VIEWSTATE" field.

RegisterOnSubmitStatement Inserts an OnSubmit attribute into the page's
<form> tag and the script to be called as its value. The first parameter is
a unique identifier for the script as a string. The second value is the
statement or function called. This creates inline code, so no <script> tags
are allowed.

RegisterStartupScript Inserts a script block just before the closing </form>
tag. The first parameter is a unique identifier for the script as a string.
The second parameter, also a string, is the complete script including the
<script> tags.
"Lukman" <ls******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi,
Could you tell me about what is RegisterStartupScript, I try to understand
from MSDN sample, but I still don't understand. Could you give me more
simple sample ? and what is the purpose of RegisterStartupScript.
Thanks,


Nov 18 '05 #2
their are a couple Register script methods. basically they control where the
script is genereated, and to help support controls that need javascript,
they are named, so the code is only generated once.

<html>
<body>
<form onsubmit="// RegisterOnSubmitStatement - goes here">
<!-- RegisterArrayDeclaration goes here - before any script -->
<!-- RegisterClientScriptBlock goes here - before any form controls -->

......
......

<!-- RegisterStartupScript goes here, after all form controls -->
</form>
</body>
</html>

-- bruce (sqlwork.com)
"Lukman" <ls******@hotmail.com> wrote in message
news:#o**************@TK2MSFTNGP11.phx.gbl...
Hi,
Could you tell me about what is RegisterStartupScript, I try to understand
from MSDN sample, but I still don't understand. Could you give me more
simple sample ? and what is the purpose of RegisterStartupScript.
Thanks,

Nov 18 '05 #3
Thanks Ken, the article is really helpful. Where can I find others articles
from you ?

"Ken Cox [Microsoft MVP]" <BA************@sympatico.ca> wrote in message
news:u%****************@TK2MSFTNGP09.phx.gbl...
There's an example in an article that I wrote some time ago:

http://www.ftponline.com/vsm/2002_07...net/page5.aspx
RegisterArrayDeclaration Inserts an array declaration into the HTML code,
including the <script> tags. Accepts both the array name and a
comma-separated list of values as a string.

RegisterClientScriptBlock Inserts a block of client-side code within the
HTML form. The first parameter is an identifying name for the block as a
string. The second parameter is a string containing the script to be sent to the client. You must include the <script> tags.

RegisterHiddenField Inserts a hidden input field with the HTML form. The
first parameter is a string that provides the input control's name. The
second parameter, also a string, is the field's initial value. In the
rendered content, this field appears just before ASP.NET's hidden
"__VIEWSTATE" field.

RegisterOnSubmitStatement Inserts an OnSubmit attribute into the page's
<form> tag and the script to be called as its value. The first parameter is a unique identifier for the script as a string. The second value is the
statement or function called. This creates inline code, so no <script> tags are allowed.

RegisterStartupScript Inserts a script block just before the closing </form> tag. The first parameter is a unique identifier for the script as a string. The second parameter, also a string, is the complete script including the
<script> tags.
"Lukman" <ls******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi,
Could you tell me about what is RegisterStartupScript, I try to understand from MSDN sample, but I still don't understand. Could you give me more
simple sample ? and what is the purpose of RegisterStartupScript.
Thanks,

Nov 18 '05 #4

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

Similar topics

6
1967
by: Bill Jones | last post by:
I'm trying to use this.RegisterStartupScript to add some javascript to and aspx page that will run when the page is loaded. Does anyone know if this function only works in the Page_Load function? ...
11
3629
by: Stan Sainte-Rose | last post by:
Hi, I m working on a user control. I need to use a Js file, I would like to know how to load the js file using RegisterStartupScript command from the user control. Also, if I load the same user...
3
2423
by: Mike | last post by:
Hi, I am trying to resize a HTML table through Javascript. When the user control loads the first time, the table is resized, but then it doesn't anymore. I am using the following code in the...
2
1516
by: Marshal Antony | last post by:
Hi, I have a problem with using Page.RegisterStartupScript to call some javascript code from ASP.NET using C# is not working in Netscape.It is working fine in Internet Explorer.Does anybody know...
0
1979
by: rom | last post by:
my main aspx page has 3 user controls. they are all located in the same place of the page and each time i set the visibility of 2 of them to false and 1 to true. now, i want to use the...
7
4426
by: sck10 | last post by:
Hello, I have the following sub in a class in my "App_Code" directory. The script is for setting focus on a particular control, but I get the error, "Name ClientScript Not declared". Also, I am...
3
10388
by: MJP | last post by:
I have a button which kicks off the generation of a report after which the file will be downloaded. The report generation can take a long time, so client side onclick event of the button also...
3
2028
by: Rob | last post by:
Hi, We've developed an ajax enabled web app which we're currently deploying to our production server. We use System.Web.UI.Page.RegisterStartupScript throughout the app, and all has worked well...
4
3874
by: =?Utf-8?B?RHVuZTg4?= | last post by:
I've got some code that uses Page.ClientScript.RegisterStartupScript to call a javascript function from the Page_Load method in the code behind. The code works fine in IE but the javascript...
0
7044
marktang
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,...
0
6908
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...
0
7045
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,...
1
6741
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...
1
4782
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
4483
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...
0
1300
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 ...
1
563
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
182
bsmnconsultancy
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...

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.