Which one of the following types of data that can be accessed on a View does notrequire typecasting?
Question 3 options:
ViewData |
|
ViewBag |
|
TempData |
|
Session |
Answer:
Option A:
ViewData is used to pass data from controller to view. It checks for null values to avoid error and it requires typecasting for complex data type.
Option B:
ViewBag is used to pass data from controller to respective view. It doesn't require typecasting for complex data type.
Option C:
TempData is used to pass data from the current request to next request, and it is used to store only one time messages like error messages and validation messages. It requires typecasting for complex data type.
Option D:
Session can also pass the data from the controller to the view and action to action. It needs typecasting to get data and check for null values to avoid error.
Option B is the Correct Answer for the given
Question
Get Answers For Free
Most questions answered within 1 hours.