473,386 Members | 2,129 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,386 software developers and data experts.

javascript in page load

hey all,

is it ok or normal to use ClientScript.RegisterStartupScript in the c#
code-behind page load event? and do i absolutely need to check for
ClientScript.IsStartupScriptRegistered("key"), especially in the page load?

thanks,
rodchar
Oct 17 '07 #1
3 1378
"rodchar" <ro*****@discussions.microsoft.comwrote in message
news:C5**********************************@microsof t.com...
is it ok or normal to use ClientScript.RegisterStartupScript in the c#
code-behind page load event?
Sure - what reservations do you have about this...?
and do i absolutely need to check for
ClientScript.IsStartupScriptRegistered("key"),
especially in the page load?
Only if your page would allow the script to be registered more than once,
e.g., via UserControls...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Oct 17 '07 #2
"rodchar" <ro*****@discussions.microsoft.comwrote in message
news:4B**********************************@microsof t.com...
i'm just wondering if this looks like stuff i can just put in the
<head><scriptsection?
I don't see why not... The server-side methods are great for dynamic
JavaScript, of course, but if your script never changes then there's no real
benefit in using them...

I'm a big fan of JavaScript, and never create static JavaScript
server-side...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Oct 17 '07 #3
RegisterStartupScript ignores secondary calls with the same key (thus
there is no way change the script once you register it). if you had a
lot of code to determine script, you can use IsStartupScriptRegistered
to skip it.

-- bruce (sqlwork.com)

rodchar wrote:
hey all,

is it ok or normal to use ClientScript.RegisterStartupScript in the c#
code-behind page load event? and do i absolutely need to check for
ClientScript.IsStartupScriptRegistered("key"), especially in the page load?

thanks,
rodchar
Oct 17 '07 #4

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

Similar topics

1
by: Julius Mong | last post by:
Dear all, according to the ASV3 manual known problem section, to make an <a> execute some Javascript onclick: ...
5
by: joaopedrogoncalves | last post by:
Hi, I want to load an external javascript file, get its results and stick them inside a <div> block. I also want to do this in several places on a web page. This way the browser doesn't have...
6
by: Erik Steffl | last post by:
I am trying to create a simple custom web spider using mozilla and javascript, the basic functionality is to open a website and then manipulate it using DOM (possibly opening links etc.). it...
3
by: Shapper | last post by:
Hello, I am working on an ASP.NET/VB web site. I have several links including menu links. Considerer a want to load a page named page.aspx. I can do it using javascript. Or using this code:...
6
by: acord | last post by:
Hi, In a html page, I don't know how to load in a php page from javascript. I've already defined a <div id="treemenu"> in the html page. The executed content from the php script is supposed...
2
by: Dave Mathew | last post by:
I'm trying to run some clientside javascript on page load for one of my ASP.Net pages. I am using the ClientScript.RegisterClient....() methods to register an external javascript file within...
22
by: Christopher Nelson | last post by:
I have a little menu system which essentially takes HTML like: <div id='foo'></div> and retrieves foo.shtml from the server and inserts it inside the <div>. But sometimes I'd like foo.shtml...
1
by: wenijah | last post by:
Hi everyone! First thank you for reading this post and yes, you probably already see that kind of topic title somewhere but the problem I've got today might be different than the 100 topics I've...
5
by: =?Utf-8?B?TWF0Y29u?= | last post by:
Hello, I have a asp.net 2.0 (vb.net) page, which uses a master page, and there is a javascript function (myfunction) defined in the <headof that master page. Is there a way to run the function...
4
by: =?Utf-8?B?R1ROMTcwNzc3?= | last post by:
Hi Guys, thanks for your help yesterday, I've got one more question, then I think I'm done for now,... Is it possible to insert recordset data in a javascript, for instance I have a javascript...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
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:
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
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...

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.