Presentation is loading. Please wait.

Presentation is loading. Please wait.

Social Media And Global Computing View and Session Data

Similar presentations


Presentation on theme: "Social Media And Global Computing View and Session Data"— Presentation transcript:

1 Social Media And Global Computing View and Session Data

2 ViewData, ViewBag, and TempData
In ASP.NET MVC there are three objects available to pass data to views Design ViewData - For passing data from a controller to a view ViewBag TempData For passing between views We will address using TempData later in the class

3 ViewData When you use ViewData data you get
Access to a ViewData objects only last during the current request Access to a ViewData object can require typecasting for getting data Controller Ex: ViewData["Message"] = "Some Value"; In View Ex: </h2>

4 ViewBag When you use ViewBag data you get
Access to a ViewBag objects only last during the current request Access to a ViewBag object does not require typecasting for getting data Controller Ex: ViewBag.Message = "Some Value"; In View Ex: </h2>

5 Session When you use Session data you get
Access to a Session objects last during the life of the user’s session (about 20 minutes when not authenticated). Access to a Session object does require typecasting for getting data Session is mainly for method-to-method message passing Controller Ex: Session["Message"] = "Some Value"; In View Ex: </h2>

6 Raw Data If you put HTML in a field, you need to use HTML.Raw() to treat the field to maintain the HTML formatting: )</h2>


Download ppt "Social Media And Global Computing View and Session Data"

Similar presentations


Ads by Google