I have downloaded a Bootstrap template(Complete GUI) from the internet and I want to add functionality to the same template using MVC. So how should I add that template to my MVC project.
I have seen many tutorials but they only tell you how to add a theme not an entire template.
I am using the cardio theme: http://tympanus.net/Freebies/Cardio/
The default MVC project includes a _Layout.cshtml file, which contains the main HTML for your template. Replace that with the HTML in the template you downloaded, making sure to copy the bits of Razor from the old code.
Then you'll need to replace the CSS files with the ones from the downloaded template and it should all work.
This all depends on how well written the template is, but I've done this many times with no problem.
Related
I have build an web application, and I want to delete some record in the database using ASP.NET MVC. But, in the delete Razor View, the CSS is not working, so the page is like this 1. This is the Delete Page of my application 2. I wonder if there are any solutions for this problem. Thank you in advance.
Check this document describe col-sm, and as i notice the CSS classes that you have been used were marked with red, so maybe the version of bootstrap doesn't contain those classes.
the reference:
https://www.w3schools.com/bootstrap/bootstrap_grid_examples.asp
I'm using asp.net mvc 3 and .net framework 4.0 with C#
Let's say I have NivoSlider( a slider ) html code. Also it has js, css and image files.
I want to use the NivoSlider cshtml code and js/css/images as "a project" and I want to add it to different MVC solutions. It will become a plugin some-how.
I can't make it a partialview, because I have to move all the css, js and imges files into new solution. I looked at "mvc areas" but it's not rendering my js and css files ( as a matter of fact; using "Areas" is not a perfect way as you know )... I looked up some plugin based architectures, but none-of-them are easy to implement. I have limited time.
So how can I solve this problem ?
EDIT: I can use this http://razorgenerator.codeplex.com/ - But I'm looking for another solutions if you came up with an idea...
You could create a private Nuget and create a small installation for it. That way you can install, update, and uninstall directly from the package.
You can even make a localized package that you copy between computers. Nuget has a very easy way to specify where you want to extract files to, and what files you want to extract.
I'm using razor generator in a commercial project and it's functional but not ideal.
Other possibilities I considered are Add files as link (see Nameless One's answer)
Also overriding the ViewEngine
Can I specify a custom location to "search for views" in ASP.NET MVC?
Or even symbolic links (shortcut links to folders in windows)
https://superuser.com/questions/234422/does-windows7-support-symbolic-links-folder-shortcuts
As recommended above, Razor views can be embedded into assembly as compiled class (by using Razor Generator).
Static resources as .html, .js, .png can be located in the assemble as embedded resource and served by application via VirtualPathProvider (custom or use existing one like https://github.com/mcintyre321/EmbeddedResourceVirtualPathProvider)
Compile your asp.net mvc Razor views into a seperate dll
I wanted to be able to embed compiled Razor views in a dll. This would allow for easy distribution of asp.net mvc ‘modules’ that have their default views embedded, but allowing you to place files in your ‘views’ folder to override those default views.
http://www.chrisvandesteeg.nl/2010/11/22/embedding-pre-compiled-razor-views-in-your-dll/
I am somewhat confused. Searched a bunch of ASP.NET related sites but could not find the answer. I must be missing some search word..
I want to find a gallery of MVC4 templates (free/cheap) and apply them to my project. Where do I do that from? I found one codeplex project (http://mvccontribgallery.codeplex.com/), but when I tried applying by copying, there were a bunch of errors (it uses something called SiteMaster, while my project seems to be using something called _layout).
I see a ton of references to people using them, applying them, but I must be missing something very fundamental since I can't even figure out how to find a list of downloadable templates.
What are the simple 1/2/3 steps for finding/getting/installing a template on my MVC4 project?
You should be looking for a suitable HTML template instead of an MVC specific template.
Once you have that, you will need to modify you master template (usually Views/Shared/_layout) to use the HTML and CSS contained within the template you have chosen.
For MVC3 or MVC4 you don't need to download any template. Just install MVC4 in your visual studio 2010 version on higher and then choose option create new project and that is that. See this below screen capture:
Microsoft will provide you the default MVC project architecture or in your term MVC template automatically when you choose any of above option marked in red box.
What do you mean by mvc4 templates? I'm assuming you mean "website template". With MVC you can use any html template, there's no specific template for MVC (that's why you're not finding any of it). You just find any website template and adapt it to mvc context (put css and images under "Content" folder and put html code in _layout and use it like masterpage), not hard to do at all. In fact, so easy to do after you get the idea that no one publish a specific adapted version :)
Follow these steps:
(note: if you have Asp.Net MVC 4, 3 won't install right (for me anyway), so uninstall and install in order).
http://tedgustaf.com/blog/2011/4/installing-asp-net-mvc3-on-visual-studio-2010-sp1/
I am working on small project Fast Food Ads in Mvc3 using c# .I want to create page where user can set the layout of page like header , footer and menu bar etc. manually so I think this page its HTML and Css file should be create dynamically. page name and css file will be unique for every user how can i do this?
I don't want to use any CMS...
In principal you can use the Razor engine in MVC3 to process any of your files. You can already do that for your HTML files.
If you want to use Razor to dynamically process (or even create, on the fly) your CSS, have a look at RazorJs. RazorJs allows Razor to pre-process Javascript files before they are included in a view. I have not looked at it's source code, but I imagine it should be straightforward to adapt it to pre-process CSS as well.
I am working on moving an application from MVC2 ASPX to MVC3 Razor, and is quite stuck moving a baseclass for more MasterPages in old MVC2 application.
The baseclass is used for automate include of css and js on pages in order to ease quickfix and debugging when developing application in local environment, but when running application in production environment it has to update and include single minimized css and js files delivered from a external CDN.
The code needs to know about the View file eg. "~/views/home/index.chtml" and/or the Layout file eg. "~/Views/DefaultNoLogon.Master" in order to include and handle css and js files correct.
I tried to implement own baseclass using the pageBaseType in Razor part of web.config, but it seems like it is executed both for View and Layout file, and I could not find a execution point where information about both View and Layout file is present. I also tried to implement the file logic using a HtmlHelper, but I can only access information about the View file and miss information for Layout file for View.
I don't want this kind of code to be implemented in Route, Controller or ViewModel since it should be related directly to generation of Views.
Any ideas how to get information about View and Layout files in MVC3 Razor app?
Well, never mind my question.
I redesigned my logic for automatic rendering of js and css files, which actually is more simple and works better. My Mvc3 Razor app is now capable to take all js and css files for a view (including css and js for all layoutpages) and render them into single minified files.
Works like a charm, and I guess it's more future proof than my old solution, unless Guthrie make fundamental changes in layoutpages and Html helpers in Mvc4 or later.