User of Razor on an MVC 2 application - asp.net-mvc

I am new to MVC so I am asking this question,
I have visual studio 2010 version 4.0.30319 SP1 Rel already installed and currently we are using MVC2 . I have been asked to you MVC3 razor view engine. So in order to get that I am assuming, I need to install this
http://www.microsoft.com/web/gallery/install.aspx?appsxml=&appid=MVC3
My question is, can I start developing using MVC3 in my existing project which is currently in MVC2 ? I dont want to modify the existing code or upgrade to MVC3. Is it possible ?
Is there any other thing that I need to download and install. What are the changes that I need to make in my web.config file or any other file to make this MVC2 project run ?
Please help

This isnt something iv'e done before but the link below will make the appropriate referential changes in order to create razor view pages.
MVC 3 Conversion
However there was a link I found on that page in the comments provided by mpost dated july 15h 2011 to a exe conversion tool. Would be interested to see how much success, if any you get from it.
Razor view converter

Related

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

SinglePageApplication - match sample videos from 2012 Fall update

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

How to update MVC 1 application to MVC 3 with razor in ASP.NET MVC

I have a MVC 1 application who i want to migrate to MVC 3 last days. i make a fresh project and rewrite all logic and put in new.
at a half :- i hear that do not changes in admin. so i include the logic from old code to fresh.
now code is not worked. so all my work look like gone.
Now i thing to migrate the project not by making fresh perhaps by using old solution [proj] i have to make upgraded to MVC 3.
so i can include changes i make in new to old.
so i need a thing that:-
How i can make MVC 1 project to MVC 3 project who can work with razor. second thing i need that used old sollution not making new sollution for migration.
are you know any thing to upgrade i can MVC 1 project to MVC 3 project. How ?
Thanks for help
Martin Aatmaa has a post on how to upgrade manually from MVC 1 to MVC 2 or you could try Eilon Lipton's upgrading tool
Then from there you might be able to use MVC 3 upgrader tool also by Eilon Lipton
I'm not aware of any tools to upgrade from MVC 1 to MVC 3 directly.
Once upgraded to MVC 3 you will then have to go through each view manually and change the code from an ASPX view to a Razor view. Note that both view engines can be used along side each other in the same project.

Resources