Bottom line is that they are essentially the same, ViewBag is just a dynamic wrapper around ViewData. ViewData is actually a dictionary used to pass data from controllers to views. The following example will make this clear,
ViewBag.Name = "Padmika"
is equal to,
ViewData["Name"] = "Padmika"
0 comments:
Post a Comment