474,045 Members | 43,403 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

including a javascript file

I am using asp.net with a C# code behind and I need to figure out how to
include a javascript file for use with my code.

It was simple to do this in classic ASP: <!-- #include File="md5.js" -->

Is there a similar way in ASP.NET?

Thanks, Justin.
Nov 18 '05 #1
3 2581
You can still include files.

You can also do it by declaring a script block and setting its source to a
JS file.

"Justin" <Ju****@discuss ions.microsoft. com> wrote in message
news:E2******** *************** ***********@mic rosoft.com...
I am using asp.net with a C# code behind and I need to figure out how to
include a javascript file for use with my code.

It was simple to do this in classic ASP: <!-- #include File="md5.js" -->

Is there a similar way in ASP.NET?

Thanks, Justin.

Nov 18 '05 #2
So, I can use <!-- #include File="md5.js" --> in the C# code behind or do I
have to put it in the .ASPX header? I the later is the case how does the c#
code access the js file?

"Marina" wrote:
You can still include files.

You can also do it by declaring a script block and setting its source to a
JS file.

"Justin" <Ju****@discuss ions.microsoft. com> wrote in message
news:E2******** *************** ***********@mic rosoft.com...
I am using asp.net with a C# code behind and I need to figure out how to
include a javascript file for use with my code.

It was simple to do this in classic ASP: <!-- #include File="md5.js" -->

Is there a similar way in ASP.NET?

Thanks, Justin.


Nov 18 '05 #3
Get used to not using include files with .NET. Use <script
language="javas cript" type="text/javascript" src="~/md5.js" /> instead.
This would be in the page content, by the way, not the code behind.
"Justin" <Ju****@discuss ions.microsoft. com> wrote in message
news:96******** *************** ***********@mic rosoft.com...
So, I can use <!-- #include File="md5.js" --> in the C# code behind or do
I
have to put it in the .ASPX header? I the later is the case how does the
c#
code access the js file?

"Marina" wrote:
You can still include files.

You can also do it by declaring a script block and setting its source to
a
JS file.

"Justin" <Ju****@discuss ions.microsoft. com> wrote in message
news:E2******** *************** ***********@mic rosoft.com...
> I am using asp.net with a C# code behind and I need to figure out how
> to
> include a javascript file for use with my code.
>
> It was simple to do this in classic ASP: <!-- #include
> File="md5.js" -->
>
> Is there a similar way in ASP.NET?
>
> Thanks, Justin.


Nov 18 '05 #4

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

Similar topics

7
5123
by: Nick Messick | last post by:
I'm trying to modify a banner display function so it can be including on remote websites. If I just include the file from a remote website the code isn't executed before it is put into the page. I would like my code (which picks a random banner) to execute on the remote site so when I include it a random banner show up.
4
1700
by: Berry B | last post by:
Hi! I'm extremely new to JavaScript programming, so bear with me pleace. I'm having trouble including a script into a page from an external .js file. I've put the following in the head; <script language="JavaScript" src="menu.js"></script> And in the body i've put the following: <BODY bgcolor="#000000" marginwirgin: 0" onLoad="printMenu()"
3
1734
by: Joseph Ferris | last post by:
Hello everyone. I recently reloaded my system, and I am now having problems getting one of my client's sites running. I pulled a copy of the development tree for the project out of subVersion (the source control software we are using) and placed it into the IIS Web Root. After building and attempting to run the Solution, I am having problems with included Javascript files. How it is set up is that we have some .js files that have...
8
3740
by: david.lindsay.green | last post by:
Hello all, I am quite new a web scripting and making web pages in general and I have stumbled across a problem I have as yet been unable to solve. I am trying to take the contents of a textarea box and save it to a file. This step is not to hard however the contents of the textarea is mostly latex source so it contains just about every special character you can imagine. My question is this, how do I save an exact copy of the textarea...
3
1660
by: Mr. Roper | last post by:
I'm pretty weak when it comes to Java script, hopefully someone will take mercy on my sole and explain this to me. How come on the following HTML page, when I have my first script tag commented out, my button calls my OnClick function. However if I uncomment the first script tag, I get the following error: Button1_onclick is not defined <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">...
38
4062
by: Neo Geshel | last post by:
I am seeking a method to load one JS file directly into another, *without* having to dynamically write <scripttags. Is there any method whereby I can call only one external JS file using a single <scripttag, but have that external JS file insert into ITSELF the contents of five others? Something like: /*start external.js*/
1
1800
by: davidemazza82 | last post by:
Hi all, I got an from IE 7.0.5730.11 when moving the <script src="..." type="text/javascript" /tag from the <headpart to the <bodysection of a HTML file. Is not possibile to include Javascript code via <script src="..." type="text/javascript" /from the <bodysection, instead from the <headone? If yes, anyone has any idea of which the problem could be? If not, how can I programmatically include a javascript external file
4
2472
by: r_ahimsa_m | last post by:
Hello, I am learning WWW technologies in Linux. I created index.html file which I can browse with Firefox/Konqueror using URL localhost/~robert/rozgloszenia/index.html. The page looks fine but there's one strange problem: I have written some JavaScript code in functions.js file which seems to be ignored when called although I have JavaScript enabled in Firefox/Konqueror. For example in functions.js I have:
1
1823
by: vunet | last post by:
What's the possible disadvantage of including JavaScript files within a JavaScript file? Why I needed it? For the sake of easy management, perhaps? Any load speed disadvantage? Example below: document.write('<script type="text/javascript" src="'+libraryName+'">< \/script>');
0
10546
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
12140
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11602
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
12023
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
11141
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
8698
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7869
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6652
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
4944
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.