Interviews4 answers
What are the state management technique in MVC?
4 Answers
There are several ways to do this in ASP.NET MVC
Hidden Field
Cookies
Query String
ViewData
ViewBag
TempData
Senthil KumarPosted Aug 9, 2018, 1:37 AM EDT
T here are several ways to do this in ASP.NET MVC
Hidden Field
Cookies
Query String
ViewData
ViewBag
TempData
Senthil KumarPosted Aug 9, 2018, 1:36 AM EDT
ASP.NET MVC offers us three options ViewData, VieBag and TempData for passing data from
controller to view and in next request. ViewData and ViewBag are almost similar and TempData
performs additional responsibility
public ActionResult Index()
{
ViewBag.Name = "Monjurul Habib";
return View();
}
public ActionResult Index()
{
ViewData["Name"] = "Monjurul Habib";
return View();
}
@ViewBag.Name
@ViewData["Name"]
Udaya KumarPosted Apr 19, 2018, 9:50 PM EDT
1. Session
2. TempData
3. ViewBag
4.ViewData
Vignesh ManiPosted Feb 16, 2016, 7:00 AM EST
