Data interaction between view and control
1.viewbag.name = "Name1"
2.viewdata["VD" = "View data";
3.tempdata["TD"] = "temp data";
4.Model
ViewBag and ViewData are valid only in the current action, with the same life cycle and View;
TempData can continue to be used by steering because its value is stored in the session. However, TempData can only be passed once and then automatically cleared by the system.
text messages such as generic strings can be passed through viewbag, if the background needs to pass multiple entities, one way is to encapsulate multiple entities into one entity and then transfer them, and the other is to place some entities in some view
5. Set the object to public in C and the view can be accessed (not recommended)
6. In the view inside the Viewbag.title definition to obtain data (equivalent to the background), and then access to the page (equivalent to ASP mode)
Return JSON
Jsonresult
Json (New {success = true, message = "Comment Saved! ", jsonrequestbehavior.allowget});
Data interaction between view and control