问题描述
我只在这里和那里读了几花絮有关地区至今并没有实际使用过它们。对于相同的RenderAction,但我遇到了,我想一定一块正在各个页面中使用,但有它自己的功能页面分离的问题。随着的WebForms我只是使用控制。随着MVC我倾向于在方法的RenderAction,然后咣当今天V2 preVIEW 1出来的区的支持。从来没有的RenderAction似乎真的所有支持要么被挤出进入期货项目。
I've only read a few tidbits here and there about areas so far and haven't actually used them. Same for RenderAction, but I am running into a problem where I want to separate a certain piece of the page that is being used across all pages but has it's own functionality. With webforms I'd just be using a control. With MVC I was leaning towards the RenderAction method, and then bam today v2 preview 1 comes out with the "areas" support. RenderAction never really seemed all that support either being pushed out into the futures project.
我的猜测是,你会想现在离走的RenderAction以下领域似乎有更多的未来支持。眼下虽然看起来你只是需要创建一个全新的项目有一个区域?
My guess is that you'd want to now stay away from RenderAction as areas seems to have more future support. Right now though it seems that you'd need to create a entire new project just to have an "area"?
所以我有一个侧边栏项目,一个面包屑的项目,一个项目UserLoggedIn ...亚克西。
So I'd have a SideBar project, a BreadCrumb project, a UserLoggedIn project...yikes.
如何赫克人们分离出来的一切?我不能运行到这个唯一的一个。
How the heck are people separating everything out? I can't be the only one that is running into this.
推荐答案
区给我的印象,以此来组织一个大的项目进入切片客区,而拥有的RenderAction一个特定的目的...提供一种方式来注入一个小部件到您的网页,而无需将数据推到每个页面需要的小工具,就像你必须用一个局部视图的视图。
Areas strikes me as a way to organize a large project into sectioned-off areas, whereas RenderAction has a specific purpose...providing a way to inject a "widget" into your page without having to push data into the view of every page that requires the widget, like you have to with a partial view.
这是填补了网页的特定部分,如菜单或工具条......在视图code的一个行调用特定的控制器上的特定方法,并返回只有你所需要的数据的完美方法该页面的特定部分。
It's a perfect way to fill specific parts of a web page, such as a menu or sidebar...One line of code in the view calls a specific method on a specific controller and returns only the data you need for that particular part of the page.
这应该能减少你的担忧正的RenderAction支持。
This should alleviate your concerns about RenderAction being supported.
这的
周五2009年7月31日上午11时29分由ScottGu
@Dominic,
Friday, July 31, 2009 11:29 AM by ScottGu @Dominic,
威尔Html.RenderAction()会使得ASP.NET MVC V2的外观?
是 - 这是对V2目前的计划
Yes - that is on the current plan for V2.
谢谢,
斯科特
这篇关于我应该使用或地区中的RenderAction ASP.NET MVC?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!