ASP.NET MVC"组件和QUOT; [英] ASP.NET MVC "Components"

查看:191
本文介绍了ASP.NET MVC"组件和QUOT;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么方法有呈现像一个小的子页面,类似的组件页面的一部分?

Is there someway to have a part of the page that renders like a little sub-page, like components?

例如,如果我有我的所有页面的购物车?

For example, if I have a shopping cart on all my pages?

推荐答案

如果你想让它呈现另一个控制器动作,作为一个组成部分,得到的封装,可以使用。

If you want it to render another controllers action, as a component, to get encapsulation, you use.

Html.RenderAction

Html.RenderAction

使用的RouteData如何到达那里的,有自己的可视数据和一种小型的生命周期

uses routedata to get you there, has its own viewdata and kind of mini life cycle

这篇关于ASP.NET MVC"组件和QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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