在ASP.net MVC3 ViewBag元件的使用寿命 [英] Lifetime of ViewBag elements in ASP.net MVC3

查看:254
本文介绍了在ASP.net MVC3 ViewBag元件的使用寿命的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在意志的值 ViewBag 刷新或清除?

When will the values of the ViewBag be flushed or cleared ?

推荐答案

当你离开的后续请求的看法。 ViewBag 在控制器中创建的,它会活到视图的渲染。除此之外,它的东西,你使用和视图模型取代它,我不会推荐。

When you leave the view on subsequent request. ViewBag is created in the controller and it will live until the rendering of the view. In addition to this it is something that I would not recommend you using and replace it with view models.

这篇关于在ASP.net MVC3 ViewBag元件的使用寿命的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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