Shopping Cart

0

Your shopping bag is empty

Go to the shop

view bag

view bag

What is ViewBag?

ViewBag is an object which is dynamically passing the data from Controller to View and this will pass the data as the property of object ViewBag. We do not need to typecast to read the data for null checking here.

Controller:

 

 

View:

 

 

Here is an example:

Controller:

 

 

View: