How can i use the same files within my new ASP.net page? any suggestions or site links would be great on adding this.. this is all going within a Master file for the site layout..
Intermediate ASP.net User, Using VS2008/VS2010 with C# and SQL2005, SQL2008, Silverlight 3
---------------------
Mark as Answered if it helped
thanks.. i tried the examples and cant get any to work.. i was able to get the include file to work.. now if i can get the javescript to work, then the include will function correctly...
I used this to get the include file to work
<% Response.WriteFile ("Yourfile.inc") %>
Any other suggestions or ideas i can try or sites i can check out..
current classic asp looks like this below, so i would like the equivelent in .net / C# if it can be done within the ASPX page thats fine, or if has to be in the code behind thats fine also.. its going in the master file.. so whatever is easier and best solution.
I made some changes and i can now see the reference when i view source on the page.. but still getting errors when the page finishes loading, i noticed that its not within the <head></head> tag, if that makes any difference, since its being done in the
code behind, not sure if it matters where it shows up on the page code.
So i now see this in the code <script
type="text/javascript"
src="/CSMeWer/csmw/mu.js"></script>
but still have the yellow triangle in the bottom corner of the browser and when i open it.. i have
Line: 84
Char: 6
Error: Invalid Argument.
Code: 0
Intermediate ASP.net User, Using VS2008/VS2010 with C# and SQL2005, SQL2008, Silverlight 3
---------------------
Mark as Answered if it helped
It may be a javescript error, but within a classic asp or html page everything works fine..
With ASP.net i have no idea where to place the script links within the page or master or whereever its suppose to go.. thats the part i cant figure out
If i move it all over to the other types of pages, everything works like a charm.
So i just need a site or tutorial that shows how to call javascript files within a .net page
thanks.
Intermediate ASP.net User, Using VS2008/VS2010 with C# and SQL2005, SQL2008, Silverlight 3
---------------------
Mark as Answered if it helped
Try a small sample to test like, create a button control in your page and call a small javascript function in your external JS file on button OnClientClick event. put a "alert("test");" and see if its firing up. If it does then you are referencing
your script file correctly.
if the alert("test"); fires up and your other javascript code does not work, then there should be some javascript error in your code which I think you should set it right or debug to work.
It may be a javescript error, but within a classic asp or html page everything works fine..
With ASP.net i have no idea where to place the script links within the page or master or whereever its suppose to go.. thats the part i cant figure out
If i move it all over to the other types of pages, everything works like a charm.
So i just need a site or tutorial that shows how to call javascript files within a .net page
thanks.
Yes, but that's not a .net page, that's just html - if there's a problem with the html that the .net app has generated, then you'll need to resove that. It's got nothing to do with .Net or master pages.
The only thing to check is to make sure that your application is really at the root of the website - if you are using the internal web server instead of IIS, chances are that you application isn't at the root, and a "/" reference will not work.
cubangt
Contributor
3052 Points
2402 Posts
Includes and .js file calls within .net
Sep 03, 2009 04:06 AM|LINK
I have a page that im trying to convert from classic ASP to ASP.net. In that file there are references to .js files and a few include calls..
Here is what im talking about:
<!--#include file="CSMeWer/csmw/mu.asp" -->
<script type="text/javascript" src="/CSMeWer/csmw/mu.js"></script>
How can i use the same files within my new ASP.net page? any suggestions or site links would be great on adding this.. this is all going within a Master file for the site layout..
---------------------
Mark as Answered if it helped
rezakawser
Participant
1687 Points
280 Posts
Re: Includes and .js file calls within .net
Sep 03, 2009 04:22 AM|LINK
Try this
http://dotnetslackers.com/articles/aspnet/JavaScript_with_ASP_NET_2_0_Pages_Part1.aspx
thnx
Please remember to click,
"Mark As Answer"
on the post that helps you.
cubangt
Contributor
3052 Points
2402 Posts
Re: Includes and .js file calls within .net
Sep 03, 2009 05:32 AM|LINK
thanks.. i tried the examples and cant get any to work.. i was able to get the include file to work.. now if i can get the javescript to work, then the include will function correctly...
I used this to get the include file to work
<% Response.WriteFile ("Yourfile.inc") %>
Any other suggestions or ideas i can try or sites i can check out..
current classic asp looks like this below, so i would like the equivelent in .net / C# if it can be done within the ASPX page thats fine, or if has to be in the code behind thats fine also.. its going in the master file.. so whatever is easier and best solution.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Examples</title>
<script type="text/javascript" src="/CSMeWer/csmw/mu.js"></script>
---------------------
Mark as Answered if it helped
cubangt
Contributor
3052 Points
2402 Posts
Re: Includes and .js file calls within .net
Sep 03, 2009 06:06 AM|LINK
I made some changes and i can now see the reference when i view source on the page.. but still getting errors when the page finishes loading, i noticed that its not within the <head></head> tag, if that makes any difference, since its being done in the code behind, not sure if it matters where it shows up on the page code.
So i now see this in the code <script type="text/javascript" src="/CSMeWer/csmw/mu.js"></script> but still have the yellow triangle in the bottom corner of the browser and when i open it.. i have
Line: 84
Char: 6
Error: Invalid Argument.
Code: 0
---------------------
Mark as Answered if it helped
Mr^B
Star
12726 Points
2245 Posts
Re: Includes and .js file calls within .net
Sep 06, 2009 08:22 PM|LINK
That's a javascript error message, so you'll need to debug the javascript.
cubangt
Contributor
3052 Points
2402 Posts
Re: Includes and .js file calls within .net
Sep 07, 2009 05:59 AM|LINK
It may be a javescript error, but within a classic asp or html page everything works fine..
With ASP.net i have no idea where to place the script links within the page or master or whereever its suppose to go.. thats the part i cant figure out
If i move it all over to the other types of pages, everything works like a charm.
So i just need a site or tutorial that shows how to call javascript files within a .net page
thanks.
---------------------
Mark as Answered if it helped
prashkumar22
Participant
1416 Points
228 Posts
Re: Includes and .js file calls within .net
Sep 07, 2009 06:49 AM|LINK
If you are still having problem referencing your javascript file try this in your master page head tags
//Assuming you have javascripts folder at root level of your application
<script type="text/javascript" src="<%=ResolveUrl("~/javascripts/ExternalJSfile.js")%>"></script>
this should resolve your jscript file correctly
Try a small sample to test like, create a button control in your page and call a small javascript function in your external JS file on button OnClientClick event. put a "alert("test");" and see if its firing up. If it does then you are referencing your script file correctly.
if the alert("test"); fires up and your other javascript code does not work, then there should be some javascript error in your code which I think you should set it right or debug to work.
Mr^B
Star
12726 Points
2245 Posts
Re: Includes and .js file calls within .net
Sep 07, 2009 07:29 AM|LINK
Yes, but that's not a .net page, that's just html - if there's a problem with the html that the .net app has generated, then you'll need to resove that. It's got nothing to do with .Net or master pages.
The only thing to check is to make sure that your application is really at the root of the website - if you are using the internal web server instead of IIS, chances are that you application isn't at the root, and a "/" reference will not work.