Monday 28 July 2014

Passing data from controller to views

In below example we will see how we can pass data from the controller to view.


In the previous example, we will see how DateTime is passed from the  Controller to View

There are two ways to pass the data from controller to view

  1. ViewData
  2. ViewBag
We have used ViewData in the below example


In the view, we can retrieve the data in view by ViewData



No comments:

Post a Comment