MVC 3部分页(剃刀)和MVC 3查看页面之间的区别与布局(剃刀)? [英] Difference between MVC 3 Partial Page (Razor) and MVC 3 View Page with Layout (Razor)?

查看:286
本文介绍了MVC 3部分页(剃刀)和MVC 3查看页面之间的区别与布局(剃刀)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在MVC 3测试版,有没有模板的 MVC 3部分页(剃刀)之间的差异 MVC 3查看页面与布局(剃刀)

In MVC 3 Beta, is there a difference between the templates MVC 3 Partial Page (Razor) and MVC 3 View Page with Layout (Razor) ?

我添加了一个局部页面(_partialList)到我的应用程序。现在,当我只返回局部视图,它适用于_ViewStart.cshtml布局present - 演技非常喜欢与布局的stardard视图页

I added a partial page (_partialList) to my application. Now when I return only the partial view, it applies the Layout present in _ViewStart.cshtml - acting very much like a stardard view page with layout.

    if (Request.IsAjaxRequest())
        return View("_partialList", someModelData);

如何做一个部分页脱颖而出从布局的标准视图页面?将在两个不同的行为在任何特定的场景?

How does a "partial" page distinguish itself from a standard view page with layout ? Will the two behave differently in any particular scenario?

推荐答案

<一个href=\"http://stackoverflow.com/questions/3925574/difference-between-mvc-3-partial-page-razor-and-mvc-3-view-page-with-layout-ra/3926150#3926150\">Darin's响应解决了将应用于您不想布局的实际问题。

Darin's response solves your practical issue of not wanting the layout to be applied.

关于两个,在剃刀它们实际上是相同的,因为这两个完整的网页和谐音使用相同的扩展,并具有相同的基类之间的差异。

Regarding the difference between the two, in Razor they are practically the same because both full pages and partials use the same extension and have the same base class.

之所以有不同的UI是因为在Web窗体视图引擎两者具有不同的扩展和不同的基类实现,这就是为什么单独的模板是必要的。

The reason why there is different UI is because in the Web Forms view engine the two are implemented with different extensions and different base classes, which is why to seperate templates are necessary.

这篇关于MVC 3部分页(剃刀)和MVC 3查看页面之间的区别与布局(剃刀)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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