473,395 Members | 1,872 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Page.RegisterClientScriptBlock v Page.RegisterStartupScript

Is there a difference between Page.RegisterClientScriptBlock and
Page.RegisterStartupScript? I've seen them both in code examples and
they both seem to be doing the same thing.

Any help would be really appreciated.
Cheers,

Mike
*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #1
3 8491
only where the script block will be placed in the html output differs. try
and see youself.
Nov 17 '05 #2
> Is there a difference between Page.RegisterClientScriptBlock and
Page.RegisterStartupScript? I've seen them both in code examples and
they both seem to be doing the same thing.

Any help would be really appreciated.
Cheers,

Mike
*** Sent via Developersdex http://www.developersdex.com ***


RegisterClientScriptBlock is meant for functions that should
be "available" to the page. For this they are rendered at the start
of the HTML file.

RegisterStartupScript is meant for commands that should execute on
page load (at the client), so tha page needs to be available for the
script. This script is rendered at the end of the HTML file.

Hans Kesting
Nov 17 '05 #3
RegisterStartupScript puts the code just before the </form> tag, while
RegisterClientScriptBlock puts it at the top. Other than that, as "The Crow"
mentioned, there is no difference.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.

"The Crow" <q> wrote in message
news:eD**************@TK2MSFTNGP12.phx.gbl...
only where the script block will be placed in the html output differs. try
and see youself.

Nov 17 '05 #4

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

Similar topics

2
by: Arjen | last post by:
Hello, I want that the client script is added at the and of the HTML output it is now at the beginning. Here is my code: private void Page_Load(object sender, System.EventArgs e) {...
1
by: Mark | last post by:
I've been reading the following link : http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html /aspnet-injectclientsidesc.asp That supposedly tells you how to use these:...
5
by: Earl Teigrob | last post by:
I am creating an application where I would like to give web designers the ablity to create a static html page and dyanamically load it into my application(exactly like loading a user control into a...
4
by: Robert Zurer | last post by:
When I click a Button server control I want two things to happen. The server returns a string array of error messages. A Javascript alert appears showing the errors. I can do this using the...
3
by: Kent Ogletree | last post by:
I need to get some JavaScript values onto an aspx page and I am not finding anything using Google. (probably not stumbled onto the right keywords) The code behind has the object that conatins the...
4
by: jef | last post by:
Experienced programmer but new to Web development and ASP.NET. I'm attempting to implement a popup window by way of using the Page.RegisterStartupScript method in my VB code-behind logic (in a...
2
by: Mark | last post by:
Hi - I have a component, which sends some Javascript to the page. I have a registerclientscriptblock which writes some Javascript which when the page is loaded, references a textbox written to...
4
by: Filip De Backer | last post by:
Hi everyone, string script = ""; script += "<script language='javascript'>"; script += "window.open('showdoc.aspx');"; script += "</script>"; Response.Write(script); After the execution of...
2
by: Keith G Hicks | last post by:
I have a fairly long page with a submit button, a validation summary and a status label at the bottom of the page. I need it to go back to the bottom after the post so that the user can see any...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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...

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.