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

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 2559
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****@discussions.microsoft.com> wrote in message
news:E2**********************************@microsof t.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****@discussions.microsoft.com> wrote in message
news:E2**********************************@microsof t.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="javascript" type="text/javascript" src="~/md5.js" /> instead.
This would be in the page content, by the way, not the code behind.
"Justin" <Ju****@discussions.microsoft.com> wrote in message
news:96**********************************@microsof t.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****@discussions.microsoft.com> wrote in message
news:E2**********************************@microsof t.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
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. ...
4
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...
3
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...
8
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...
3
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...
38
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 ...
1
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...
4
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...
1
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: ...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...

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.