Introduction To Passing Data in NET
Introduction To Passing Data in NET
Interactivity
It enables user interactions and actions within the application.
How does data pass from Model to
View?
1 2 3
3 TempData
A dictionary-like structure used to store data temporarily between controller actions,
typically during redirects.
ViewData
Functionality Loose Typing
Allows passing data from controllers to views Requires casting the data when retrieved in the
using key-value pairs. view.
Output
ViewBag
TempData allows you to store data that needs TempData supports strong typing. This
to persist for a short duration, typically across means you can specify the type of data you're
redirects. storing in TempData, providing compile-time
type safety and reducing the risk of runtime
errors related to data type mismatches.
Output