SinglePageApplication - match sample videos from 2012 Fall update - asp.net-mvc

I am trying to recreate the ASP.NET Single Page application as demonstrated by Steven Sanderson
Single Page Applications - for desktop, mobile, tablet with ASP.NET MVC4
I have downloaded and installed the Build Preview - http://www.asp.net/vnext
I have using NuGet, tried to update my SPA Scaffolding to ASP.NET SPA MVC 4 (Beta)
I am running Visual Studio 2012
When i create a new MVC4 application, there are some distinctive differences between what i have and the demo's i see.
Primarily, after create a new project, if you view what you have the sites look completely difference
What Steve Sanderson Gets
What I Get
Then continuing to follow his example, he created a controller and has an option of
Single Page Application with read/write actions and views, using Entity Framework
This is not avaiable in my Create Controller Dialog
What Steve Sanderson Gets
What I Get
Why are my options differen't?
What have I not installed?
Thanks for any help

The new SPA template is a completely different template, as you have discovered. Short story ... the new template is revised to be a starting place, the old template was deemed too prescriptive.
The new template is a preview and will have more changes by the time it is released. The idea is you can use it as a starting point for a SPA and then add features and other libraries as needed.
UPDATE: If you want more info on what's in the latest template you can read my post here: http://www.johnpapa.net/insidespatemplate

Related

Using ASPX View Engine with MVC 5

Is it possible to use ASPX view engine with MVC 5?
We have a product using MVC 4 on ASPX view engine and we want to migrate to MVC 5, however, when I create a new project in VS 2013, select MVC and try to add a new View, I don't see any option to add a view using ASPX View Engine. Has Microsoft stopped with ASPX View Engine? Is there any way to still use ASPX?
This is what a blog post regarding the release of VS2013 said: "The HTML editor used by Razor files (.cshtml and .vbhtml) as well as normal HTML files has been replaced with entirely new code. Web Forms (.aspx and .ascx) involve significantly more complexity and did not fit into a well-polished release for Visual Studio 2013, so they will be updated in an upcoming product release. " Source:http://blogs.msdn.com/b/webdev/archive/2013/06/27/html-editing-features-in-visual-studio-2013-preview.aspx
It's installed by default. just check out the ViewEngines.Engines collection. Its output are:
System.Web.Mvc.WebFormViewEngine
System.Web.Mvc.RazorViewEngine

Use Bootstrap 3 RC1 in the New MVC 5

Microsoft has used Bootstrap in their new ASP.Net MVC 5 template. It's really great. However it uses the version 2.3.1 of it and the Bootstrap guys are moving towards the 3 version already. I could just easily rewrite the entire views and the layouts based on the new version but I was wondering if somewhere, someone else has done it (maybe by a long shot the Microsoft folks?).
I know the rules (that I really appreciate) is to put code here instead of link for my blog post but it's just too many small corrections to put them here.
http://www.ghislainproulx.net/Blog/2013/09/using-bootstrap-3-with-visual-studio-2013-aspnet-mvc-template
I have created a NuGet package Bootstrap.MVC.EditorTemplates.Sample that contains a Bootstrap 3 based sample site, plus some additional bootstrap controls and culture-aware validation. This works with the VS 2013 RC MVC5 template.
It uses the Twitter.Bootstrap.Less package instead of the plain bootstrap package, it is best to "uninstall-package bootstrap" from the default MVC 5 site before installing it in the project.
The main idea of making Bootstrap 3 work on ASP.NET-MVC 5 project (or any other server side technology) is to put proper css and js files into the project and make Layout file use these.
This is very well covered in the blog by #Ghislain_Proulx.
Then all you have to do is follow the syntax rules of Bootstrap 3 in your Views.
One way to do it is use straight html markup. Another - use custom helpers. #Maarten has a cool open sourced EditorTemplates of these. However, I'd suggest using TwitterBootstrapMVC as it provides a high level of flexibility.
Disclaimer: I'm the author of TwitterBootstrapMVC and using it for Bootstrap 3 requires a license.
Now that Bootstrap 3 final release is out, and so is Visual Studio 2013 RC and ASP.NET MVC 5 RC, it's confirmed that the RTM of ASP.NET MVC 5 will come with Bootstrap 3 (even though it's not in ASP.NET MVC 5 RC yet).
Until ASP.NET MVC 5 RTM / Visual Studio 2013 RTM, the post referenced in the accepted answer would be the wya to go.

Using the razor engine in SharePoint 2013 Visual Web Part

I'm trying to make use of the razor engine in a SharePoint 2013 Web Part. This, I read, shouldn't be too difficult since SharePoint 2013 Visual Web Parts can be built using .NET Framework 4.0
I'm simply not sure of where to begin to do this. I've seen an article on uploading the .cshtml file onto a document library and referencing the document library in the Web Part, but it is a bit unclear.
Does anyone have an idea of how I can start? Or point me to a step-by-step guide to achieve what I am after.
What my end goal is: Take a piece of an MVC application, customize it and make it a Web Part. I need to be able to modify or access SharePoint content on that site which is why I cannot use an App Part.
Okay.
First install the Office Development Templates from
http://www.microsoft.com/visualstudio/eng/office-dev-tools-for-visual-studio
This will give you the following template selection on reopening Studio
Then navigate to wherever EwsManagedApi32.msi is and enter the following command in an elevated prompt -
EwsManagedApi32.msi addlocal="ExchangeWebServicesApi_Feature,ExchangeWebServicesApi_Gac"
Now your templates are usable and the one you want is "VS2012 Web Part".
Now, by default this will add an ASP.NET project, which is not what you want, so manually delete the ASP.NET project, add an MVC one, highlight the SharePoint project in Solution Explorer, hit F4, and select the MVC project in the "Web Project" dropdown at the bottom of the properties.
And there you go. One controller per web part, sorted.
I am sharing link SharePoint MVC webpart that uses Knock out framework using MVC for SharePoint. It has step by step instructions which might help you.
Hope this will be a good starting point
http://www.codeproject.com/Tips/739445/SharePoint-Razor-View-WebPart

How to open MVC 4 view page from webform.aspx page?

basically i am looking for something like this ,
i got webform.aspx page and have button there, if i click on it i need to show MVC view page
idea is i want app with webform and mvc !
what i am trying is :
http://www.packtpub.com/article/mixing-asp.net-webforms-and-asp.net-mvc
but here i am confused about webconfig settings
please help me to get it done,
thanks
Scott Hanselman has a good guide on integrating MVC with a Web Form App, it should take you through the steps, here it is in a nutshell:
Run the Upgrade Wizard (open the Visual Studio2008 Web Application
in Visual Studio 2010)
Create a default ASP.NET MVC application for reference (you'll throw it away later)
Use a differencing tool like Beyond Compare to integrate the new web.config entries from the ASP.NET MVC sections into the upgraded ASP.NET WebForms application

How to add a custom project template in new Asp.Net MVC 3 project dialog?

I'm developing a plugin based application using MEF and Asp.NET MVC 3 and I want to create a custom project template to give third party developers when creating new plugins for application.
I can easily export it as a project template but since the host is developed in ASP.NET MVC 3, It seems more logical to be inside new Asp.Net MVC 3 project dialog.
Any ideas?
After some digging and 'reflecting', I got a template to successfully show up in the dialog. Most of the credit goes to this post: Add custom viewengine to New project dialog?
The key to getting it working on my machine (64bit) was the registry path mentioned in the answer in that post. I also found via Reflector there is a SupportsHTML5 key too, if you need that.
Here is a screen shot of my template:
and here are the registry keys (there is also a title and description at the MyOwnTemplate node)
If you look up your template directory for Visual Studio, and check out the template:
MvcWebApplicationProjectTemplatev3.0.cs.zip
(VS Install dir)\Common7\IDE\ProjectTemplates\CSharp\Web\1033
The thing to look at here is this line:
<WizardExtension>
<Assembly>Microsoft.VisualStudio.Web.Mvc.3.0, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35</Assembly>
<FullClassName>Microsoft.VisualStudio.Web.Mvc.UserInterface.MvcTemplateWizard</FullClassName>
</WizardExtension>
So they have got a custom Wizard working here.
these questions look to be similar:
Blank Asp.net MVC template
How to write an MVC3 Project Template that will offer option Razor or .aspx views
Basically, they say the wizard isn't open source but you could potentially write your own custom wizard.
EDIT:
here are a couple of page that tell you how to create your own wizard:
http://msdn.microsoft.com/en-us/library/ms185301.aspx
http://www.codeproject.com/KB/system/create_VS_wizard.aspx
I just wrote a blog post that covers how to do this and provides a zip file and a batch file with an example.
http://haacked.com/archive/2011/06/06/creating-a-custom-asp-net-mvc-project-template.aspx

Resources