473,287 Members | 1,880 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,287 software developers and data experts.

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 1099
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
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
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
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
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>...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

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.