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

Поделиться
HTML-код
  • Опубликовано: 18 янв 2013
  • Buy full MVC 5 & MVC CORE course from here www.questpond.com/learn-mvc-5...
    For more such videos visit www.questpond.com
    For more such videos subscribe ruclips.net/user/questpondvide...
    See our other Step by Step video series below :-
    Learn C# Step by Step goo.gl/FNlqn3
    Learn Design Pattern Step by Step:- goo.gl/eJdn0m
    Learn Angular tutorial step by step tinyurl.com/ycd9j895
    Learn MVC Core step by step :- tinyurl.com/y9jt3wkv
    Learn Azure Step by Step :- tinyurl.com/y6fmrech
    Learn SharePoint Step by Step in 8 hours:- goo.gl/XQKHeP
    Python Tutorial for Beginners:- • Python Tutorial for Be...
    Learn Data Science in 1 hour :- tinyurl.com/y5o7qbau
    Learn Power BI Step by Step:- tinyurl.com/y6thhkxw
    Learn MSBI Step by Step in 32 hours:- goo.gl/TTpFZN
    Learn SQL Server Step by Step tinyurl.com/ja4zmwu
    Learn Tableau step by step :- tinyurl.com/kh6ojyo
    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 :-
    goo.gl/1br5mb
    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).
    Visit us at www.questpond.com for more details
    We are also distributing a 100 page Ebook "ASP.NET MVC". If you want this ebook please share this video in your facebook/twitter/linkedin account and email us on questpond@questpond.com with the shared link and we will email you the PDF.

Комментарии • 74

  • @dnfvideo
    @dnfvideo  3 года назад +1

    Do not miss our Interview Question video series
    25 Important ASP.NET Interview Questions : ruclips.net/video/pXmMdmJUC0g/видео.html
    30 Important C# Interview Questions : ruclips.net/video/BKynEBPqiIM/видео.html
    25 Angular Interview Questions : ruclips.net/video/-jeoyDJDsSM/видео.html
    5 MSBI Interview Questions : ruclips.net/video/5E815aXAwYQ/видео.html

  • @praveendubey1994
    @praveendubey1994 10 лет назад +2

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

  • @bjblk1
    @bjblk1 8 лет назад +1

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

  • @dpkbahuguna
    @dpkbahuguna 11 лет назад +3

    The session is very descriptive and informative to set the basics of MVC.
    Thanks...Keep posting the Training :-)

  • @monsieurrodriguez9687
    @monsieurrodriguez9687 Год назад +2

    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

  • @amishkumar5320
    @amishkumar5320 10 лет назад +2

    enjoyed alot with your videos keep good works on thanks

  • @RaviHandsome
    @RaviHandsome 10 лет назад +14

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

  • @mohamedsaied5780
    @mohamedsaied5780 6 лет назад

    Good video and good explanation regardless the small mistakes.

  • @wase39
    @wase39 10 лет назад +1

    very simple and elegant lesson

  • @JayadevNelli
    @JayadevNelli 7 лет назад

    Very good video, thank you for posting.

  • @manishkjanu
    @manishkjanu 11 лет назад

    Very useful information. Thanks!

  • @TubaMirza-co7ql
    @TubaMirza-co7ql 3 месяца назад

    11 years old video waw .. still knowledgeable

  • @CodeSbyAniz
    @CodeSbyAniz 3 года назад

    Great Job. Thanks for the video

  • @theUnboxerfalcon
    @theUnboxerfalcon 7 месяцев назад

    Thank you for a brilliant video..

  • @coolayer
    @coolayer 11 лет назад

    Thanks Brother! It was very helpful.

  • @fcinternetmarketing
    @fcinternetmarketing 11 лет назад

    Love this video.

  • @MrSanjdhi
    @MrSanjdhi 11 лет назад

    nice efforts for beginners and all. Keep it up.

  • @TheAsimiy
    @TheAsimiy 11 лет назад

    Very nice tutorial .... thanks Sir

  • @218manish
    @218manish 10 лет назад

    Nice & useful Tutorial

  • @bhuvanatn
    @bhuvanatn 11 лет назад

    Thanks very much..very helpful

  • @ims4666
    @ims4666 3 года назад

    Awesome explanation....

  • @talalshoaib3099
    @talalshoaib3099 8 лет назад

    Very nice video thank you sir :)

  • @manoharjulakanti8688
    @manoharjulakanti8688 7 лет назад

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

  • @VannaraLoch
    @VannaraLoch 10 лет назад +11

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

  • @tsogiaidze
    @tsogiaidze 9 лет назад

    Great!

  • @Robsonsantosxd
    @Robsonsantosxd 9 лет назад

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

  • @rohanthakur6136
    @rohanthakur6136 6 лет назад

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

  • @rprabhuit
    @rprabhuit 10 лет назад +18

    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.

    • @prateekbhardwaj9943
      @prateekbhardwaj9943 9 лет назад +1

      +Prabhu Raja Exactly i was thinking the same.. but every where i read this that tempdata for controller to controller ... ? is it true for mvc 3? or in mvc 4 we can use controller to view (one cycle)

    • @nimitjoshi8639
      @nimitjoshi8639 8 лет назад +4

      I have worked on MVC 5 project and in that i have used TempData to pass the info from Controller to View.

    • @mohamedsaied5780
      @mohamedsaied5780 6 лет назад +1

      msdn.microsoft.com/en-us/library/system.web.mvc.tempdatadictionary(v=vs.118).aspx
      You can use a TempDataDictionary object to pass data in the same way that you use a ViewDataDictionary object. However, the data in a TempDataDictionary object persists only from one request to the next, unless you mark one or more keys for retention by using the Keep method. If a key is marked for retention, the key is retained for the next request.
      A typical use for a TempDataDictionary object is to pass data from an action method when it redirects to another action method. For example, an action method might store information about an error in the controller's TempData property (which returns a TempDataDictionary object) before it calls the RedirectToAction method. The next action method can then handle the error and render a view that displays an error message.

  • @rohitashkumar7765
    @rohitashkumar7765 8 лет назад

    Nice video

  • @rohitshinde8145
    @rohitshinde8145 4 года назад

    helpful ty.

  • @SultanAhmed-xx1oz
    @SultanAhmed-xx1oz 2 года назад

    THank YUo

  • @ARV-sf5td
    @ARV-sf5td 5 лет назад +1

    What is the difference between tempdata keep and peek

  • @bhaktilife111
    @bhaktilife111 Год назад

    So beautiful

  • @dnfvideo
    @dnfvideo  11 лет назад

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

  • @akshaygaikwad817
    @akshaygaikwad817 9 лет назад +15

    you have given wrong viewbag name in sampleview1 while geting its data in string varible and shown null value

    • @shailabgupta8746
      @shailabgupta8746 8 лет назад

      +akshay gaikwad, yes i also caught this problem

    • @nimitjoshi8639
      @nimitjoshi8639 8 лет назад

      Yes. I was thinking about to mention it. But i saw your comment which is related to this. +1

    • @Nandakishore48
      @Nandakishore48 7 лет назад

      yaa dude you are right

    • @mohamedsaied5780
      @mohamedsaied5780 6 лет назад

      yes, CurrentDateAndTime while in another CurrentDateTime but it will lead to null also if he typed it correct as viewbag cann't transfer data between controllers

  • @arunvenkatesh6464
    @arunvenkatesh6464 5 лет назад

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

  • @chandanadas7860
    @chandanadas7860 4 года назад +1

    tempdata is controller to controller and also controller to view

  • @92_shwetadhande92
    @92_shwetadhande92 Год назад

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

  • @knowledgeys6652
    @knowledgeys6652 5 лет назад

    I believe Tempdata sends the data from one view to other View..

  • @niteshkr.upadhyay3506
    @niteshkr.upadhyay3506 3 года назад

    Is it really wrong?
    At 11:17 he added a value in ViewBag.CurrentDateAndTime but was receiving with ViewBag.CurrentDateTime
    That's wrong na?
    How will it fetch the value?

  • @akashverma1640
    @akashverma1640 2 года назад

    Sir at 12:07 you have used wrong name of variable in viewbag i.e viewbag.CurrentDateTime instead of Viewbag.CurrentDateAndTime that is why it's null.

  • @amruthbinish
    @amruthbinish 11 лет назад

    how can we create mvc views faster and make them strong typed by using html helper ---where this video?

  • @odytrice
    @odytrice 10 лет назад

    You can also pass TempData to the View

  • @sinchanar440
    @sinchanar440 5 лет назад

    Sir, I have a question please give me a reply. How do I set session for multiple user login and I want to differentiate as Admin and local user...

    • @RanjeetKumar-gg7ie
      @RanjeetKumar-gg7ie 4 года назад

      through authorization differentiate between admin & local user , also set HttpContext.Current.Session.Timeout = x ,( x is time ) to set diff timeout as per user accessibility..

    • @RanjeetKumar-gg7ie
      @RanjeetKumar-gg7ie 4 года назад

      Create a master base class inherit it on master page
      if you are storing information in session about user type
      and write a function
      if(Session["admin"] !=null){
      if(Session["admin"].ToString() == "True")
      {
      HttpContext.Current.Session.Timeout = 120;
      }if(Session["user"].ToString() == "True")
      {HttpContext.Current.Session.Timeout = 60;
      }else
      {HttpContext.Current.Session.Timeout = 30;}
      }
      or you can replace session with profile if you are using profile

  • @balaram438
    @balaram438 9 лет назад

    thanks you so much it was nice explanation

  • @NeelanjanaDutta
    @NeelanjanaDutta 7 лет назад

    I cannot see any view engine drop down list in the add view page. so I cannot open aspx view. kindly suggest.

    • @dnfvideo
      @dnfvideo  7 лет назад

      Please mail us your query at questpond@questpond.com

    • @sameerkhatri1918
      @sameerkhatri1918 6 лет назад

      If you get the solution please let me know or you can send me an email on ersameer.khan05@gmail.com

  • @prateekbhardwaj9943
    @prateekbhardwaj9943 6 лет назад

    you should correct the information, this is a very old video. controller to view is possible in tempdata aslo

  • @ragavaragala9116
    @ragavaragala9116 4 года назад

    In action method samlpeview you mentioned current dateandtime but second action method you mentioned current datetime you don't mentioned and

  • @multanimohsin8800
    @multanimohsin8800 9 лет назад

    where is the lab 9

  • @sujanvaland
    @sujanvaland 11 лет назад

    its not that we tempdata is not maintain from Controller to View, we can maintain the data

  • @dnfvideo
    @dnfvideo  9 лет назад

    Want to Learn MVC 5 in 2 days start from the below video :-
    goo.gl/1br5mb
    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?
    Visit us at www.questpond.com for more details

    • @naeemahmad9698
      @naeemahmad9698 9 лет назад

      .NET Interview Preparation videos sir from where i can get complete video series please guide

    • @dnfvideo
      @dnfvideo  8 лет назад

      +Naeem Ahmad Please visit www.questpond.com and mail to us on questpond@questpond.com

  • @mayanksingh3277
    @mayanksingh3277 8 лет назад

    hi

  • @prashantkumar15689
    @prashantkumar15689 4 года назад

    In case of view bag you set another variable and tried to get value from wrong variable. Don't try to confuse viewers and don't anything wrong. Concept is right what you said but demonstrated wrongly.

  • @donfeto7636
    @donfeto7636 5 лет назад

    information are not complete you give so little info

  • @s3123ww
    @s3123ww Год назад

    @questpond : Now, We can pass data from controller to view using Tempdata. Please remove your old videoz, i beg. Outdated information can be harmful to your brand.

  • @bjblk1
    @bjblk1 8 лет назад +1

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

  • @bjblk1
    @bjblk1 8 лет назад

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