Use ViewBag to transfer data from controller to view, viewbag View
In the http://www.cnblogs.com/insus/p/4308740.html of ASP. net mvc reading XML and displaying ViewData, ViewData is used in the Controller to transmit data to the view. In this article, Insus. NET wants to use ViewBag.
Insus. NET simulates an example to display an image. For example, a project contains several images:
Create a model with the following attributes:
Create Entity:
Create a controller. If the Controller already exists, open it and create an Action. In the Action, store the List <T> data to the highlight part of ViewBag. X.
Create View:
The Razor syntax in this article is that the Code is directly encapsulated in @ {...}, and the previous article is a line expression (variable and function) that starts.
The image path can be interpreted as @ url. Content.
Demo: