How to develop Breadcrumbs for a single page Backbone.js based ASP.NET MVC Application - asp.net-mvc

Im working on a single page ASP.NET MVC application. We are using Backbone.js + JQuery for client side UI and design. I need to put breadcrumbs for Backbone views(which are similar to pages in a forms based application). How to achieve this?
Thanks.

I think you can just use backbone. It does not matter if you're using ASP on the server. There are plenty of ways to do it. You can place a property in your views that relates to the breadcrumb and then just use it when you render.
If your urls are easily readable you can just parse the url and use that.

Related

How to load HTML page in MVC 5 for Angularjs routing?

I want to use the SPA concept of angularjs in MVC 5, but cant handle the routing. I want my main page to view in Razor and load portion of the page using angularjs.
I know my description is not sufficient but hope anyone will help me through.
Thanks in advance.
Look at the project template AngularStart
https://visualstudiogallery.msdn.microsoft.com/cc6c9c5f-2846-4822-899f-a6c295cd4f2b
I am author of this template and it shows how can client side routing and mvc routing can be combined. This has been created for MVC 4, but you will get an idea.
I also created a blog post http://blog.technovert.com/2013/12/setting-up-angularjs-for-asp-net-mvc-n-webapi-project/ explaining the approach.
You may run into conflict if routing is setup both for MVC 5 and Angular. For SPA portion use only Angular routing. That being said you can still have a hybrid solution for partials where angular templates are assembled by Razor templates (which is a very powerful feature).

Can we just use ASP.NET MVC routing for MVC/AngularJS applications?

I'm quite new to AngularJS but have lots of experience with ASP.NET MVC. For my next project, I'm thinking of using AngularJS (mainly for two-way data binding purposes). In the past I've used the KnockoutJS to achieve this.
Could someone please help me understand whether or not the design approach below is good?
MVC action will return JsonResult.
AngularJS will call these actions using $http service.
AngularJS will be used for binding JSON properties to HTML elements.
AngularJS will then call actions to post data.
MVC routing engine will be used instead of AngularJS'.

Architectural advice for a SPA ASP.NET application

I'm starting a new project, based on ASP.NET. The application will be a registry with a web interface. It will be used by ca 3000 users.
It has been ca 4 years since I last started a new project so I'm a "bit" rusty when it comes to the latest trends..
I wish the new application to be SPA so I investigated some Javascript MV* frameworks and finally settled on Durandal, Bootstrap (for layout) and Telerik's Kendo UI with ASP.NET MVC helpers.
I installed a template called Hot Towel, which created a ASP.NET MVC based Durandal project setup. However, I see that Views are html not Razor's cshtml. Can I still use cshtml files (for helper classes to work)? Is there any downfall in this?
Also I heared a discussion that when using Durandal, one shouldn't use ASP.NET MVC but rather just Web API. What do you think of that? I'd still like to use MVC helpers here and there..or is there a good reason for abandoning it for Web API?
Do you have any other considerations and recommendations on a new project setup?
Best wishes,
Andrew
Someone who knows a more about durandal than I may be able to shed some light on the part of using cshtml views. I would imagine that you would have to override the viewLocator and point it to controller actions rendering partial views??? (you need them to be parsed by the Razor engine to get valid HTML).
As for using regular html files, I have used a fantastic library called knockout-kendo
for using kendo UI components in SPA applications. I find it just as easy to use as the HTML helpers, all while keeping the application a true SPA, and you then serve up all of your data via WebAPI controllers.Hope this is of some help.
EDIT: Perhaps you can also have a look at this answer How can I use cshtml files with Durandal?. There are a few answers there that seem to be doing what you are looking to do..

benefit of using angular js on top of asp.net mvc

Is there much point to using angular js on top of asp.net mvc since they're kind of both doing the same thing? What are the advantages to using angular over asp.net mvc + jquery? What kind of scenario would you pick angular in? If you do pick angular in a microsoft environment, what would you run on the server side? Would it be something like Web API? Or is there still benefit of using traditional asp.net mvc?
This question is a bit subjective, however here was our reasoning.
Let the client handle rendering of pages, free up resources on the server.
Leverage built in caching of cache servers since we are just dealing with <html/> content.
Since the pages are cached the only traffic back and forth is json payloads.
We have been using NancyFx, but WebAPI or Service Stack would work just fine.
We wanted to build a responsive single page application and AngularJs fit the bill for testability as full feature rich framework.
AngularJs forces you into a pattern that we needed for JavaScript, in the past our jQuery heavy applications turned into functional spaghetti (That was our fault but being guided by Angular helped out a lot).
As with all frameworks pick the one that suites your needs
On my site http://www.reviewstoshare.com, I am using AngularJS along with ASP.NET MVC. The main reason I did not go all the way with AngularJS was that SEO is not easily achieved with AngularJS.
Keep in mind that my site was already built using ASP.MVC + Jquery for in page interaction as needed.
On the other hand there is still some "Ajaxy" nature to the site like comments, voting, flagging etc. Not too different than Stackoverflow itself. Before AngularJS it was a mess of Jquery plugins and functions within $(document).ready() callback, not to mention the JS code was not testable much.
In the end, I went with both.
If you fancy using Java Script framework then Angular JS rocks.
SEO could be the issue. You need to have deeper understanding of DOM and Java Script as compared to other famous JS Frameworks.
I ve developed a Proof of Concept - using Angular JS with Require JS using ASP.net MVC
You can have a look at it at the below given link
http://angualrjsrequirejsaspmvc.blogspot.com/2013/08/angular-js-with-require-js-front-end.html

Incorporating MVC functionality in an existing ASP.net project

We have an intranet system developed using asp.net webforms. We are kind of planning to partly incorporate mvc and such a scenario is as follows,
We would like to generate html documents using mvc (using razor view engine) where the inputs are going to come from a normal asp.net webform (from a form button click or so)
Some pointers or references to tutorials on running these 2 scenarios side by side would help a lot.
ASP.Net MVC and WebForms postbacks don't mix; the only way to do this would be to use <iframe>s (which is not a good idea).
I am not sure about your described implementation... however, you could start by re-writing some of your aspx pages using MVC views and just get all the existing code behind into a controller to minimize the creation of new code. You could do this one page at a time until all of your pages are MVC views. Good luck.

Resources