• How to use ViewBag, ViewData and TempData  in ASP.NET MVC?

    by  • October 19, 2015 • Microsoft .NET Framework, Microsoft ASP.NET MVC, Microsoft Visual Studio .NET • 0 Comments

    ViewData, ViewBag and TempData are used to pass data from controller to view. ViewBag and ViewData are almost similar but TempData is different from them. Each of them has its own importance. We use the ViewData, ViewBag, and TempData objects for the purposes of transporting small amounts of data. In this articles you will learn about how to use ViewBag, ViewData, TempData and Session in ASP.NET MVC.


    ViewData and ViewBag are used for the same purpose to transfer data from controller to view. TempData is a dictionary which is derived from TempDataDictionary class. Many developers used Session instead of TempData to store data for short time. TempData help us to transfer data between different controllers or actions.




    Best WordPress Themes and Plugins with Great Team and Support!

    Avatar of Abdul Rehman


    Abdul Rehman writes on .NET technologies at GetCodeSnippet.com. GetCodeSnippet.com provides you high quality Microsoft .NET development related articles, tutorials and sample code for ASP.NET, C#, VB.NET, AJAX, WCF, WPF, Web Services, Windows Services, SQL Server and other technologies.


    Leave a Reply