I am updating a few year old website which was originally built with MVC4 (VS2012 perhaps). I am pretty sure after update 3 when I add a new view using scaffolding I now get the MVC5 style views using Bootstrap, etc. This site doesn't use bootstrap and there are no plans to add it at this time. Is there a way to reference the old style scaffolding template so I don't need to build (or rebuild) the view pages by hand after they created?
Currently using VS2015 Update 3
It appears that nuget package Microsoft.AspNet.Mvc is running 5.2.3. Is this the reason I am getting MVC 5 scaffolding templates?
Scaffolding uses Code Templates, but only to define the Create, List, Edit, Details,Delete and Empty Views. It means that the css are inherited from your _Layout.cshtml. Just remove the bootstrap reference from that and it should work. If you want to customize your Scaffolding layouts, just change the Code Template:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\ItemTemplates\CSharp\Web\MVC 4\CodeTemplates\AddView\CSHTML
More info:
http://www.hanselman.com/blog/ModifyingTheDefaultCodeGenerationscaffoldingTemplatesInASPNETMVC.aspx
Related
I have an existing project that is running Umbraco 7.10
Whenever we create a new view, the template is not created in Umbraco (but new Partials are) when we deploy to existing environments
We are not using uSync at present and the umbracoSettings.config template section is set to Mvc rather than WebForms
What is stopping the template being present in Umbraco? is it something I am missing in the cmsTemplate table?
Many thanks
You need to create the template in Umbraco and then manually include in your VS project not the other way around.
There is a db component to a template/view which only gets created if you do things from Umbraco rather than VS. Partials do not have a db component and are simply read from the file system.
uSync would be a good move if you have separate databases for different environments otherwise you will have to add the template to each Umbraco instance.
I'm starting now with web development in Visual Studio. I have already understood MVC, I have some knowledge of HTML and I started to study the bootstrap.
Then, I discovered the beautiful template Free Bootstrap 3 Admin Template on the web, which has an example online here: https://colorlib.com/polygon/gentelella/index.html
I downloaded the files like custom.css and custom.min.css as they are shown in the following image:
But now I don't know how to put it in my project, so I created a new clean project in Visual Studio Community 2015. I did some tests, and I created some controllers and views.
How can I change the default bootstrap theme that came with ASP.NET MVC project to the downloaded one?
I imagine I should replace the _Layout in the shared folder. But what else should I bring?
I do not want all those example pages, etc. Just Bootstrap and the base layout to create my view's.
I have found everything I needed from a YouTube video, entitled "Plantilla Bootstrap en Proyecto ASP.NET MVC" (obviously in Spanish).
There are many steps:
Adding files to the project
setting the _Layout
set scripts references
bundles
Etc.
Ultimately, it worked.
step one
Create a MVC project Default template in visual studio
Step Two
Delete All cshtml in view folder expect shared folder
you must be detrmine wthich part of your page repeatly in all pages that is your layout and you can put html tag like header menu and footer in /views/shared/_layout.cshtml and write renderbody in part of layout to see default login homepage or etc
finaly
all css and java script folder paste in your project and in layout change target to available js and css resource
Learn about mvc Layout
Understand Css And JavaScript embed from bundle
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
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.
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