ViewBag, ViewData and TempData

后端 未结 8 1903
半阙折子戏
半阙折子戏 2020-11-22 04:43

Could any body explain, when to use

  1. TempData
  2. ViewBag
  3. ViewData

I have a requirement, where I need to set a value in a control

8条回答
  •  眼角桃花
    2020-11-22 05:42

    Also the scope is different between viewbag and temptdata. viewbag is based on first view (not shared between action methods) but temptdata can be shared between an action method and just one another.

提交回复
热议问题