MVC - Style and Layout
Translation results:
MVC is one of three ASP.NET programming patterns.
MVC is a pattern for creating Web applications using MVC (Model View Controller model-view-controller) design:
Model (model) represents the core of the application (such as a database record list).
View displays data (database records).
Controller handles input (writes database records).
MVC pattern provides full control over HTML, CSS and JavaScript simultaneously.
MVC - Style and Layoutsyntax
The file _Layout.cshtml represents the layout for each page in the application. It's located in the Shared folder within the Views folder.
MVC - Style and Layoutexample
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>@ViewBag.Title</title> <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" /> <script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")"></script> <script src="@Url.Content("~/Scripts/modernizr-1.7.min.js")"></script> </head> <body> <ul id="menu"> <li>@Html.ActionLink("Home", "Index", "Home")</li> <li>@Html.ActionLink("Movies", "Index", "Movies")</li> <li>@Html.ActionLink("About", "About", "Home")</li> </ul> <section id="main"> @RenderBody() <p>Copyright RUNOOB 2012. All Rights Reserved.</p> </section> </body> </html>