标签:
一、整理好母版页
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width" /> <title>@ViewBag.Title</title> </head> <body> @RenderSection("Head",false) <h2>-------顶部--------</h2> <img src="~/Content/sy.GIF" alt="Alternate Text" /> <br /> @RenderBody() <h2>--------底部--------</h2> </body> </html>
二、添加视图,将使用布局或母版页打上勾
三、视图文件
@{ ViewBag.Title = "Text"; Layout = "~/Views/Shared/_Layout.cshtml"; } <script src="~/Scripts/jquery-1.7.1.js"></script> <script type="text/javascript"> $(function () { $("#btn").click(function () { alert(); }); }); </script> <input type="button" id="btn" value="确定" />
运行效果如下图:
标签:
原文地址:http://www.cnblogs.com/genesis/p/4882786.html