473,503 Members | 4,692 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Registering javascript via the Page object, why?

This is not really a problem I'm having it's more of a general question

if you had an html page with embedded javascript script and you sent it to
the
browser if the script wasn't buggy, it would instantly work because
javascript is interpreted

I have created buttons on the fly (say in the editmode of a 1.x datagrid)
and I added the function as an attribute of that button, using
Attributes.add() etc...
but why does ASP.Net require you to Register Javascript, using some of the
Page's methods (Register, RegisteratStartup etc..), surely it's all text and
when it arrives at the browser, the browser will just tie it all together and
interpret the javascript on the fly, no?
thanks in advance and Regards,
CharlesA
May 15 '06 #1
3 1109
The Page APIs for registering javascript is to ensure only one copy of the
block of javascript in the page. Perhaps a custom control requires 100 lines
of javascript. Well what if the page uses 5 of these custom controls? If
they didn't 'coordinate' then you'd end up with a lot of bloat. Using the
Page APIs ensures this coordination.

-Brock
http://staff.develop.com/ballen

This is not really a problem I'm having it's more of a general
question

if you had an html page with embedded javascript script and you sent
it to the browser if the script wasn't buggy, it would instantly work
because javascript is interpreted

I have created buttons on the fly (say in the editmode of a 1.x
datagrid)
and I added the function as an attribute of that button, using
Attributes.add() etc...
but why does ASP.Net require you to Register Javascript, using some of
the
Page's methods (Register, RegisteratStartup etc..), surely it's all
text and
when it arrives at the browser, the browser will just tie it all
together and
interpret the javascript on the fly, no?
thanks in advance and Regards,
CharlesA

May 15 '06 #2
Thanks Brock,
That's an interesting answer...
however why wouldn't you be able to just add that Javascript yourself at the
top of the page (in HTML design view), or as a .js file, and then it wouldn't
matter how many things referred to it, it would only be there once...

Regards,
CharlesA
May 15 '06 #3
The idea is that the custom control knows how to emit its own javascript.
So that the developer doesn't have to.

If you are using a 3rd party control, you have no idea what it does behind
the scenes and what javascript it emits - you just know that it works.

"CharlesA" <Ch******@discussions.microsoft.com> wrote in message
news:7F**********************************@microsof t.com...
Thanks Brock,
That's an interesting answer...
however why wouldn't you be able to just add that Javascript yourself at
the
top of the page (in HTML design view), or as a .js file, and then it
wouldn't
matter how many things referred to it, it would only be there once...

Regards,
CharlesA

May 15 '06 #4

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

Similar topics

6
1970
by: Daniel Bass | last post by:
The scenario: ------------- I've created a simple COM object according to a tutorial I found: http://www.csharphelp.com/archives/archive281.html It automatically creates a Type Library...
6
4128
by: ian | last post by:
Hi All I have a DLL (nahd.dll) that has been supplied to me will a PBX phone system. According to the documentation it is to allow developers to write there own applications to monitor the...
3
1225
by: kshort | last post by:
I have a javascript that loads picture names into an array in the head section of the web page and a javascript in a table cell within the body of the html that references the array of image names. ...
4
1675
by: Jonathan Wood | last post by:
I'm trying to duplicate an HTML sample I have using my ASP.NET pages. The sample contains the following within the <headtag: <script type="text/javascript" src="flashobject.js"></script>...
0
7207
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
7357
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...
1
7012
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...
0
7468
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...
0
5598
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5023
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
3180
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1522
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 ...
0
402
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.