简体   繁体   中英

ASP.NET MVC HTML Template

I have a recurring piece of HTML in my MVC4 project and as I am working on it I have to go through and edit it in each file that uses it.

I am wondering if there is a way to set up some kind of template that just has this small snippet of code and call in it the files where it is needed? It would make editing and debugging much simpler.

Its not a whole page but just a small section that is on certain web pages.

Any help would be appreciated.

You should absolutely look at the Razor engine and partial views:

http://rachelappel.com/razor/partial-views-in-asp-net-mvc-3-w-the-razor-view-engine/

A great codebase to look at if you're a quick learner: http://www.codeproject.com/Tips/617361/Partial-View-in-ASP-NET-MVC

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM