摘要: Controller:using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; namespace _04_RazorExpression.Controllers { public class HomeController : Controller { public ActionResult Index() { ViewBag.Message = "Welcome t... 阅读全文
posted @ 2012-08-11 15:24 清山博客 阅读(335) 评论(0) 推荐(0)
摘要: 视图数据可以通过ViewBag属性访问,它主要是为了从Controller到view进行传值用的,类似有所使用的ViewData[] 字典类。对于ViewBag是如此的强大,意味着你能动态的set/get 值,增加任何数量的的额外字段而不需要强类型的检测。如:Controller?publicActionResult Index(){List<string> colors = newList<string>();colors.Add("red");colors.Add("green");colors.Add("blue& 阅读全文
posted @ 2012-08-11 12:26 清山博客 阅读(5332) 评论(0) 推荐(1)