Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #31 (permalink)  
Old February 6th, 2015, 03:10 PM
Registered User
Points: 29, Level: 1
Points: 29, Level: 1 Points: 29, Level: 1 Points: 29, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2014
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks, that worked. I have one final question. My master is in the root. The references in my master's head, do they need to reference files as though I am located where my .aspx pages that are based on the master are or where the master is? I ask because master was in root (so I thought this reference would work) but my .aspx pages based on it are all in subfolders. Thanks again
Reply With Quote
  #32 (permalink)  
Old February 7th, 2015, 08:40 AM
Imar's Avatar
Wrox Author
Points: 71,804, Level: 100
Points: 71,804, Level: 100 Points: 71,804, Level: 100 Points: 71,804, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,038
Thanks: 80
Thanked 1,580 Times in 1,557 Posts
Default

They need to be referenced relative to the page that uses them, not to the master page.

That's why the root-reference in the link is so important. Without it, for pages in the root the master page would need to use

Scripts/SomeScript.js

For pages in the folder Account it would need:

../Scripts/SomeScript.js

and for pages in Account/SignUp it would need

../../Scripts/SomeScript.js

You can't have all of these at the same time. By pointing to:

/Scripts/SomeScript.js

the script file is searched for in the Scripts folder in the root of th site.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #33 (permalink)  
Old February 7th, 2015, 11:07 AM
Friend of Wrox
Points: 1,905, Level: 17
Points: 1,905, Level: 17 Points: 1,905, Level: 17 Points: 1,905, Level: 17
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2011
Posts: 411
Thanks: 13
Thanked 7 Times in 7 Posts
Default This is the way that it should be done

Since this response ended up in my email box once again, I will respond:
ProjectX:
So if you have .js file that you need to use and that has common functionality across the scope of your ASP.NET app, the best way to handle it, instead of using all of this artificial complexity with all kinds of hardwired dependencies that can get really messy like this example with the conflicting or difficult to follow path statement to .js files, instead it would be better to do it the AngularJS way and declare it a service or a factory and have the dependency injected as part of your Angular modules that are using a controller to handle or manipulate the view in the DOM of your HTML. Let the AngularJS use run time environment of the application thread deal with it all on the client side. That is a far more elegant solution to the problem, that you are facing and it would make far more sense to use it like that in a situation like this. Two way data binding with the AngularJS JavaScript library gives you some cool stuff and makes for some very nice interactive functionality that can really add a lot of pizzaz and punch to your application.
I know this because I currently have two really cool SPAS/websites that I developed and are online that are in AngularJS, Bootstrap with an MS WebAPI endpoint to a SQL Server Database that feeds JSON back to the front end that was developed in Visual Studio 2012 professional edition. This is a really neat way to go because you can get the data from the backend and then cache it on the front end in AngularJS and then manipulate it and display with AngularJS and Twitter Bootstrap it for public front end consumption without all of this back and forth from the server to the client, which makes an application written like that far more mobile ready or hand held device compliant. This book kind of explains what I am talking about. I recommend it after your finish this book that you are currently on:

https://www.packtpub.com/web-develop...net-developers

Last edited by vbboyd; February 7th, 2015 at 12:06 PM.
Reply With Quote
  #34 (permalink)  
Old February 7th, 2015, 11:16 AM
Friend of Wrox
Points: 1,905, Level: 17
Points: 1,905, Level: 17 Points: 1,905, Level: 17 Points: 1,905, Level: 17
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2011
Posts: 411
Thanks: 13
Thanked 7 Times in 7 Posts
Default

Quote:
Originally Posted by Imar View Post
They need to be referenced relative to the page that uses them, not to the master page.

That's why the root-reference in the link is so important. Without it, for pages in the root the master page would need to use

Scripts/SomeScript.js

For pages in the folder Account it would need:

../Scripts/SomeScript.js

and for pages in Account/SignUp it would need

../../Scripts/SomeScript.js

You can't have all of these at the same time. By pointing to:

/Scripts/SomeScript.js

the script file is searched for in the Scripts folder in the root of th site.

Cheers,

Imar
Project x

If you are not getting your JavaScript files and are not coming in like you expect them to because you have the wrong path statements (or for some other reason) then I suggest to you that you can trouble shoot them in your Safari or your Chrome Web browser debugger. The debugger will log it and will tell you what .js dependencies are found and are being used and which are not able to be found and are not being used. Go to your Chrome browser and download the developer tools debugger suite and then you can see some really cool stuff happening. Just right click on the webpage in your Chrome or Safari browser and select "Inspect Element" and the debugger window will come up at the bottom of the screen and you can poke around on it and you can see some of the stuff that I am talking about. I think that it will throw an HTML 404 error code exception if I am not mistaken if you have the wrong path statements to your .js code file dependencies and the run time environment of the application can't find the files that are needed to run the app. Here is some video lessons that will show more of what I am talking about:

https://www.youtube.com/watch?v=dNsM2PUkZ1g

https://www.youtube.com/watch?v=htZAU7FM7GI

https://www.youtube.com/watch?v=Z3HGJsNLQ1E

https://www.youtube.com/watch?v=Gpvk8VPlYmE

PS I am just trying be of service to you and help you out a little bit, and not be annoying.

Last edited by vbboyd; February 7th, 2015 at 12:12 PM.
Reply With Quote
  #35 (permalink)  
Old February 7th, 2015, 11:28 AM
Imar's Avatar
Wrox Author
Points: 71,804, Level: 100
Points: 71,804, Level: 100 Points: 71,804, Level: 100 Points: 71,804, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,038
Thanks: 80
Thanked 1,580 Times in 1,557 Posts
Default

Quote:
Since this response ended up in my email box once again, I will respond:
That really isn't needed if you have no direct answer to the question to contribute. Simply unsubscribe and you're done.

Quote:
Instead it would be better to do it the AngularJS way and declare it a service or a factory and have the dependency injected as part of your Angular modules that are using a controller to handle or manipulate the view in the DOM of your HTML.
What a nonsense. It's all true from an app development point of view but completely unrelated to the original question posted by Project x. Don't you think you still need to understand how to reference the Angular library so it gets downloaded correctly?

Quote:
But I betcha not even Imaar will admit to that in a million years.
I don't know who Imaar is. If you mean me, my name is Imar, and you would be completely wrong. I use Angular a lot and I really like it. But not for every project I do.

@Project x: feel free to start a new topic that isn't tracked by vbboyd who appears to only post here to annoy people. He's better left ignored; much better for your heart ;-)

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #36 (permalink)  
Old February 7th, 2015, 11:37 AM
Friend of Wrox
Points: 1,905, Level: 17
Points: 1,905, Level: 17 Points: 1,905, Level: 17 Points: 1,905, Level: 17
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2011
Posts: 411
Thanks: 13
Thanked 7 Times in 7 Posts
Default Okay

Don't you think you still need to understand how to reference the Angular library so it gets downloaded correctly?

Do you mean like this?:

Code:
<script src='bower_components/angular/angular.js'></script>
<script src='bower_components/angular-route/angular-route.js'></script>
<script src='app.js'></script>
</body>
</html>

Is that what you are talking about?
Reply With Quote
  #37 (permalink)  
Old February 7th, 2015, 11:52 AM
Friend of Wrox
Points: 1,905, Level: 17
Points: 1,905, Level: 17 Points: 1,905, Level: 17 Points: 1,905, Level: 17
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2011
Posts: 411
Thanks: 13
Thanked 7 Times in 7 Posts
Default Annoying

Quote:
Originally Posted by Imar View Post
That really isn't needed if you have no direct answer to the question to contribute. Simply unsubscribe and you're done.

What a nonsense. It's all true from an app development point of view but completely unrelated to the original question posted by Project x. Don't you think you still need to understand how to reference the Angular library so it gets downloaded correctly?

I don't know who Imaar is. If you mean me, my name is Imar, and you would be completely wrong. I use Angular a lot and I really like it. But not for every project I do.

@Project x: feel free to start a new topic that isn't tracked by vbboyd who appears to only post here to annoy people. He's better left ignored; much better for your heart ;-)

Cheers,

Imar
I was not trying to be "annoying" despite what you may think. I was just trying to give the guy some idea or some suggestions that he might want to follow if he decides to take the next steps after he finishes this book and nothing else.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
move_uploaded_file frustration plugnz BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 1 February 18th, 2010 07:59 AM
Frustration with VB Editor jeremy1048 Access 3 October 26th, 2007 02:10 PM
Pure ASP Upload ozzii Classic ASP Professional 1 January 8th, 2007 06:41 PM
using a expression causing frustration s.wright Access VBA 1 July 26th, 2006 04:37 PM
ComboBox Mayhem Frustration. snw C# 1 November 28th, 2005 05:06 AM



All times are GMT -4. The time now is 12:01 AM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.