18 April 2014

Passing Data From Controller to a view -- Basics MVC(Model View Controller)

ViewBag is used to pass data from a controller to the view.ViewBag object holds the data. 

The given below example shows the working of ViewBag in MVC.

Go to Home Controller


Goto Views>>Index.cshtml



 The HTML output Will be


No comments:

Post a Comment