如何为项目中的所有页面设计mvc3 _layout和site.css [英] how to design mvc3 _layout and site.css for all pages in project

查看:79
本文介绍了如何为项目中的所有页面设计mvc3 _layout和site.css的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨...

设计MVC3 _layout和site.css,但它并没有在project的所有pges中显示。它仅在索引页面中显示。我该怎么办pls。

Hi...
Am design MVC3 _layout and site.css,but it is not showing in all pges in project.It's shows in index page only. how can i do it pls.

推荐答案

site.css文件由布局引用。默认情况下,您应该具有所有视图的布局,因为您必须指定是否不需要布局,或者您需要另一个布局。

您应该查看此官方教程:http://weblogs.asp。 net / scottgu / archive / 2010/12/30 / asp-net-mvc-3-layouts-and-sections-with-razor.aspx [ ^ ],特别是创建视图模板部分。



在本教程中,有一个方法介绍了如何在VisualStudio中创建视图cshtml文件 - 单击操作方法。上面的图片仅在这种情况下显示。如果您通过在视图子文件夹中创建文件直接创建视图,则需要自己添加所有元数据。
The site.css file is referenced by the layout. By default you should have layout for all views, since you have to specify if you don't want the layout or you want a different one.
You should look at this official tutorial: http://weblogs.asp.net/scottgu/archive/2010/12/30/asp-net-mvc-3-layouts-and-sections-with-razor.aspx[^], especially section Creating a View Template.

In the tutorial there is a method presented how you can create view cshtml file in VisualStudio by right-click in the action method. The image above will show up only in this case. If you make your views directly by creating files in the view subfolders you need to add all metadata by yourself.


这篇关于如何为项目中的所有页面设计mvc3 _layout和site.css的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆