Answer Posted / Suleman Ahmad Salmani
ViewData and ViewBag in MVC are used to pass data to the view from the controller. However, there is a subtle difference between them. ViewData is strongly typed (i.e., you have to specify the type of the data), while ViewBag is dynamically typed (i.e., you don't need to specify the type, and it automatically detects the data type based on the name).
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers