MVC Video :- Difference between viewdata,viewbag,tempdata and session.(MVC Interview questions)

preview_player
Показать описание

See our other Step by Step video series below :-

In this MVC ( Model view controller) video we will try to understand what is the difference between viewdata,viewbag,tempdata and session.This is an interesting MVC interview question and below is a textual answer for the same.

Temp data: - Helps to maintain data when you move from one controller to other controller or from one action to other action. In other words when you redirect, "tempdata" helps to maintain data between those redirects. It internally uses session variables.

View data: - Helps to maintain data when you move from controller to view.

View Bag: - It's a dynamic wrapper around view data. When you use "Viewbag" type casting is not required.

Want to Learn MVC 5 in 2 days start from the below video :-

The following syllabus has been covered in Learn MVC 5 in 2 days

Learn MVC 5 in 2 days
Lab 1 : - Simple Hello world(20 Minutes)
Lab 2 : - Explain MVC Routing(10 Minutes)?
Lab 3 : - Explain ViewData, ViewBag, TempData & Session Variables?(20 Minutes)
Lab 4 :- Explain Model and Strongly typed views (20 minutes)?
Lab 5 : - Explain Model Binders(10 minutes)?
Lab 6 :- Why MVC and MVC vs Webforms ? (30 minutes)
Lab 7 :- Explain TempData , Peek and Keep ? (10 Minutes)
Lab 8 : - Explain Data Annotations and HTML Helpers classes?(31 Minutes)
Lab 9 : - What is the need of ViewModel in MVC? (10 Minutes)
Lab 10 : - How can we use Entity Framework in MVC?(20 minutes)
Lab 11 : - How to implement viewmodel, partial view and webgrid?(45 minutes)
Lab 12 : - What is the difference between ActionResult and ViewResult in MVC?(10 minutes)
Lab 13 :- How to implement Ajax using Json and Jquery in MVC ? (60 Minutes)
Lab 14 : - What is the use of Async Controllers in MVC?(20 minutes)
Lab 15 :- How to deploy MVC Application on IIS ? (10 minutes)
Lab 16 :- How can we do Windows and Forms Authentication in MVC? (50 Minutes)
Lab 17 : - How can we use MVC areas for better modular development ? (10 Minutes)
Lab 18 :- How to implement MVC with Angular ? (60 minutes) ?
Lab 19 :- Can we Overload MVC Action methods ? (10 Minutes)
Lab 20 :- How to improve Reusability using Angular ? (20 Minutes) ?
Lab 21 :- What is the need of WebAPI in MVC ? (30 Minutes)
Lab 22 : - How to do exception handling in MVC? (30 Minutes)
Lab 23 :- How to do update and delete using MVC , WebAPI , EF and Angular? (30 Minutes)
Lab 24 : - How to use MVC Webgrid?(30 minutes)
Lab 25 :- How to implement Validation using Angular and MVC (30 minutes)?
Lab 26 :- What is SPA (Single page application)?
Lab 27 :- How to Organize MVC project and Understanding CORS issue ? (42 minutes)
Lab 28 :- Explain the importance of DisplayModes ? (10 minutes)
Lab 29 :- How to do unit testing with MVC projects (30 minutes)?
Lab 30 :- How to implement SPA using Angular Routing ?
Lab 31 :- How to create decoupled systems using MVC DI ?
Lab 32 :- How can we have multiple submit buttons in ASP.NET MVC ?
Lab 33 : - What is the importance of AntiForgery in MVC?
Lab 34 :- What is the importance of ValidateInput and AllowHTML in MVC?
Lab 35:- Bundling and Minification(15 minutes)
Lab 36 :- Layout pages in Razor
Lab 37: - What are ActionFilters in MVC?
Lab 38: - What is WebAPI (Theory)?
Lab 39: - How can we create and consume WEB API (Practical)?
Lab 40 :- MVC 6/ASP.NET Core Training-Part 1 (2 Hours).

Рекомендации по теме
Комментарии
Автор

Do not miss our Interview Question video series

dnfvideo
Автор

Thanks, Awesome, Short, Simple and helps to understand exactly what is needed.

praveendubey
Автор

you didn't test the same name in the viewbag controllers communication example, at minute eleven, you put ViewBag.CurrentDateTime while actually it was named ViewBag.CurrentDateANDTime.
Anyway, thanks for the video, the point was explained successfully

monsieurrodriguez
Автор

Excellent video. Thank you very much. I will eventually watch all of your videos.

bjblk
Автор

The session is very descriptive and informative to set the basics of MVC.

Thanks...Keep posting the Training :-)

dpkbahuguna
Автор

enjoyed alot with your videos keep good works on thanks

amishkumar
Автор

11 years old video waw .. still knowledgeable

TubaMirza-coql
Автор

Example is incorrect though concept is right.
CurrentDateAndTime and CurrentDateTime are different at 12:20

RaviHandsome
Автор

wrong statement on TempData usage. TempData can be used from controller to view as well. The TempData will be reset to null, only after it was read or used. But we can keep the data's in TempData after read by calling TempData.Keep() function. The Keep() should be called immediately after TempData object used.

rprabhuit
Автор

Very good video, thank you for posting.

JayadevNelli
Автор

Good video and good explanation regardless the small mistakes.

mohamedsaied
Автор

Sorry it was my mistake to type the wrong property name.

dnfvideo
Автор

but your two viewBag variable is not the same...one is CurrentDateAndTime one is CurrentDateTime

VannaraLoch
Автор

nice efforts for beginners and all. Keep it up.

MrSanjdhi
Автор

Could anyone send the link of the next lesson ? i couldn't find it.
Great Lesson BTW!

Robsonsantosxd
Автор

Excellent video sir. Thank you very much. how to get MVC Asp.Net Q & A Series.

rohanthakur
Автор

hi sir, i used temp data in view and also in action method ...then also data is transferring from action method to

manoharjulakanti
Автор

PLS MAKE VIDEO ON CASCADING DROP DOWN LIST
LOAD DATA FROM DATABASE AND SAVE DATA TO DATATBASE

arunvenkatesh
Автор

What is the difference between tempdata keep and peek

ARV-sftd
Автор

sir please provide link of how to pass data from view to controller?

_shwetadhande