云南网站建设快速优化,网络关键字优化,淘宝关键词挖掘工具,html5可以做交互网站吗原文#xff1a;http://www.cnblogs.com/highend/archive/2011/04/18/asp_net_mvc3_layout.html Layout页:该家伙其实就相当于原来的Master文件. Partial页:相当于原来的UserControl View页: View Page with Layout:等同于原来的View Content Page.它的功能只是为了实现原来在…原文http://www.cnblogs.com/highend/archive/2011/04/18/asp_net_mvc3_layout.html Layout页:该家伙其实就相当于原来的Master文件. Partial页:相当于原来的UserControl View页: View Page with Layout:等同于原来的View Content Page.它的功能只是为了实现原来在Layout/MasterPage下所定义的占位符.当然在原来的MasterPage中如果你没有实现原先定义 的占位符asp:ContentPlaceHolder /,那么在最终合并输出的时候MasterPage占位符asp:ContentPlaceHolder /那里就会输出空. 1.Layout页基础: RenderBody():直接渲染整个View到占位符处,而不需要原来所使用的asp:Content / 使用在~/Views/Shared/的LayoutPage文件 !DOCTYPE html
html
headtitleViewBag.Title/title
/head
bodydiv开始渲染Bodybr /RenderBody()渲染Body结束br //div
/body
/html 在~/Views/Home/Index.cshtml文件 {ViewBag.Title 首页;
}div这里就是渲染Body啦.其实因为RenderBody()不在有歧义.
/div 注意默认路由配置Global.asax、项目的属性-web-启动操作一般设置为当前页面 Layout RenderSection(SectionJS, false) view Render SectionJS{ 内容 } 注RenderSection可以很好的运用到css和js脚本上