Part 3 ViewData and ViewBag in mvc
ViewBag and ViewData is a mechanism(机制) to pass data from controller to view.
We use '@' symbol(符号) to switch between html and C# code.
Both ViewData and ViewBag are used to pass data from a controller to a view.
ViewData is a dictionary of object that are stored and retrieved(取回) using strings as keys.
ViewBag uses the dynamic feature that was introduced in to C#4. It allows an object to have properties dynamically added to it.
Both ViewData and ViewBag does not provide compile time error checking. For example, if you mis-spll keys or property names, you wouldn't get any compile time error. You get to know about the error only at runtime. Internally ViewBag properties are stored as name/value pairs in the ViewData dictionary.
Part 3 ViewData and ViewBag in mvc的更多相关文章
- 在Asp.net MVC 3 web应用程序中,我们会用到ViewData与ViewBag,对比一下:
Asp.net MVC中的ViewData与ViewBag ViewData ViewBag 它是Key/Value字典集合 它是dynamic类型对像 从Asp.net MVC 1 就有了 ASP. ...
- Asp.net MVC的ViewData与ViewBag以及TemplateData的使用与区别
ViewData ViewBag 它是Key/Value字典集合 它是dynamic类型对像 从Asp.net MVC 1 就有了 ASP.NET MVC3 才有 基于Asp.net 3.5 fram ...
- asp.net mvc中ViewData、ViewBag和TempData的详解
一.ViewData和ViewBag 1.ViewData和ViewBag都是从Action向View传递数据的方式,当然还有其他方式如向View传递Model. 2.ViewData页面查询数据时需 ...
- .NET MVC TempData、ViewData、ViewBag
说明: 原文作者贤新 原文地址:http://www.cnblogs.com/chenxinblogs/p/4852813.html ViewData和ViewBag主要用于将数据从控制器中传递到视图 ...
- ASP.NET MVC 中的ViewData与ViewBag
在Asp.net MVC 3 web应用程序中,我们会用到ViewData与ViewBag,对比一下: ViewData ViewBag 它是Key/Value字典集合 它是dynamic类型对像 从 ...
- ASP.NET MVC 传值方法ViewData与ViewBag的区别
一.介绍 在Asp.net MVC 3 web应用程序中,我们会用到ViewData与ViewBag,对比一下: ViewData ViewBag 它是Key/Value字典集合 它是dynamic类 ...
- ASP.NET MVC程序传值方式:ViewData,ViewBag,TempData和Session
转载原地址 http://www.cnblogs.com/sunshineground/p/4350216.html 在ASP.NET MVC中,页面间Controller与View之间主要有以下几种 ...
- Asp.net MVC中的ViewData与ViewBag
Asp.net MVC中的ViewData与ViewBag 在Asp.net MVC 3 web应用程序中,我们会用到ViewData与ViewBag,对比一下: ViewData ViewBag 它 ...
- MVC传递Model之TempData、ViewData、ViewBag差别及用途
MVC使用过程中常常会用到TempData.ViewData.ViewBag三种方式,这三种什么差别呢? TempData:默认存储于Session中,可通过继承ITempDataProvider接口 ...
随机推荐
- 理解MapReduce哲学
Google工程师将MapReduce定义为一般的数据处理流程.一直以来不能完全理解MapReduce的真义,为什么MapReduce可以“一般”? 最近在研究Spark,抛开Spark核心的内存计算 ...
- CodeForces 176A Trading Business 贪心
Trading Business 题目连接: http://codeforces.com/problemset/problem/176/A Description To get money for a ...
- [Angular 2 Router] Configure Your First Angular 2 Route
Using the Angular 2 router requires defining routes, passing them in to the RouterModule.forRoot and ...
- Cocos2d-x v3.0 新的事件调度方法 lambda表达式的使用
欢迎添� Cocos2d-x 交流群: 193411763 转载请注明原文出处:http://blog.csdn.net/u012945598/article/details/24603251 Coc ...
- IOS编程之相机和相册
概述 IOS设备中的相机和相册,是我们在项目开发中经常会使用到的多媒体元素,使用相机可以获得最新想要的照片,而使用相册则可以访问IOS设备中的图片资源 使用IOS设备中的相机/相册获得图片资源 是否允 ...
- MYSQL 博客
DavidYang的博客 - CSDN.NET DimitriK's (dim) Weblog Xaprb · Stay Curious! 飞鸿无痕的博客 - ChinaUnix博客 何登成的技术博客 ...
- css笔记 css用法:
前端框架:AdminLTE https://almsaeedstudio.com/themes/AdminLTE/index2.html CSS学习教程: http://www.divcss5.co ...
- MTD NANDFLASH驱动相关知识介绍
转:http://blog.csdn.net/zhouzhuan2008/article/details/11053877 目录 MTD总概述 MTD数据结构 MTD相关层实现 MTD,Memory ...
- CSS 之 内层div填充margin,外层div的背景色不会覆盖该margin
外层元素(如div)中只有一个非空子元素,此时margin是被折叠了.两者之间取最大的margin值,表现在外层父元素上,而不是内层子元素. 注意: (1)只有垂直方向上才会出现此现象,水平方向不会出 ...
- Triangular Sums
描述 The nth Triangular number, T(n) = 1 + … + n, is the sum of the first n integers. It is the number ...