 |
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|
|

February 6th, 2015, 03:10 PM
|
|
Registered User
|
|
Join Date: Mar 2014
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

February 7th, 2015, 08:40 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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
|
|

February 7th, 2015, 11:07 AM
|
|
Friend of Wrox
|
|
Join Date: May 2011
Posts: 411
Thanks: 13
Thanked 7 Times in 7 Posts
|
|
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..
|
|

February 7th, 2015, 11:16 AM
|
|
Friend of Wrox
|
|
Join Date: May 2011
Posts: 411
Thanks: 13
Thanked 7 Times in 7 Posts
|
|
Quote:
Originally Posted by Imar
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..
|
|

February 7th, 2015, 11:28 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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
|
|

February 7th, 2015, 11:37 AM
|
|
Friend of Wrox
|
|
Join Date: May 2011
Posts: 411
Thanks: 13
Thanked 7 Times in 7 Posts
|
|
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?
|
|

February 7th, 2015, 11:52 AM
|
|
Friend of Wrox
|
|
Join Date: May 2011
Posts: 411
Thanks: 13
Thanked 7 Times in 7 Posts
|
|
Annoying
Quote:
Originally Posted by Imar
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.
|
|
 |
|