Part 5- Difference between ViewBag and Viewdata and TempData | Peak and Keep

  Рет қаралды 58,801

Technotips Ashish

Technotips Ashish

Күн бұрын

Overview:
In this video you can practically distinguish the ViewBag , ViewData and TempData .This question is very common in every interview so be prepared for this .
It is notable if any redirection occurs then viewbag and viewdata value gets null but tempData value get preserved if and only if tempData.Keep() method is being used.
SOCIAL :
Like TechnoTips official Page : / technotipstutorial
Subscribe : / aapkanigam
Follow us on Twitter : @technotipsMVC
VISIT OUR BLOG:
technotipstutor...
INTRODUCTION :
ViewData and ViewBag
Used to pass data from controller to corresponding view.
ViewData is a dictionary of objects that is derived from ViewDataDictionary class and is accessible using strings as keys.
ViewBag is a dynamic container.
ViewData requires typecasting for complex data type and check for null values to avoid error.
ViewBag doesn’t require typecasting for complex data type.
Ex : ViewBag.MyName=“Ashish” , ViewData[“MyName”]=“Ashish"
TempData:
TempData is also a dictionary object derived from TempDataDictionary class and stored in short lives session
It helps to maintain data when you move from one controller to other controller or from one action to other action
Ex : TempData[“MyName”]=“Ashish”
TAGS :
how to create a - website
asp. net mvc
asp.net mvc interview questions
asp .net mvc tutorial
asp. net mvc 4
asp.net mvc 5 tutorial
asp net mvc developer
asp net mvc continuous integration
asp net mvc hosting
model view controller
jquery-ajax
$ ajax jquery
jquery ajax tutorial
viewbag
$controller
$model
razor view engine
$how to get rich

Пікірлер: 29
@monjurulislam5393
@monjurulislam5393 Жыл бұрын
why you code change off recording
@mi5956
@mi5956 4 жыл бұрын
simple and great examples. I was confused with other tutorials. thank you very much
@manishverma3941
@manishverma3941 Жыл бұрын
Thanks
@komalkushwaha1977
@komalkushwaha1977 6 жыл бұрын
Hi you haven't tell about the peak method..
@shyamtiwary2578
@shyamtiwary2578 7 жыл бұрын
hi technotips, great video .. request you to add videos on mvc entity framework implementing crud..
@aapkanigam
@aapkanigam 7 жыл бұрын
+Shyam tiwary please watch part 15 onwards .. :)
@shyamtiwary2578
@shyamtiwary2578 7 жыл бұрын
Thanks
@trr5088
@trr5088 8 жыл бұрын
Everything is working so far, except for the TempData on the TestController. It will not show the name. Instead it shows ["Employee.NameTD"] on the View TempData["Employee.NameTD"] = "John"; The View page works fine except for this glitch. Do you have a suggestion on the casue?
@aapkanigam
@aapkanigam 8 жыл бұрын
+TR Rooks (TRR) use @ symbol before tempdata on view
@aapkanigam
@aapkanigam 8 жыл бұрын
+TR Rooks (TRR) make sure if u r redirecting to other controller or method then use tempdata.keep () method in order to preserve its value
@trr5088
@trr5088 8 жыл бұрын
Ashish, Thanks for the pointer. I had not noticed the line in the Index view or the Second Page View. I had only written.... Your tempData value is ["EmployeeNameTD"] When I added the @TempData as shown below, it works as your demonstration. @TempData["EmployeeNameTD"]
@bhaskarkholiya8125
@bhaskarkholiya8125 6 жыл бұрын
hi Ashish, please make a video on How to Set Admin LTE theme in ASP.NET MVC.
@petermankge6921
@petermankge6921 4 жыл бұрын
Great tutorials to learn MVC easily....Thank you!!!
@annuverma936
@annuverma936 6 жыл бұрын
thumps up very good explanation.
@tamilkumarang
@tamilkumarang 5 жыл бұрын
We have to add second page. Cshtml file? .. U forgot to mention that in this video..
@Bhargavarigela
@Bhargavarigela 5 жыл бұрын
how to add second page?
@hatah01
@hatah01 7 жыл бұрын
Do you have any tutorials on how to design a blog in MVC? I have been following the tutorials and would like to add a commenting system. Any pointers for me?
@aapkanigam
@aapkanigam 7 жыл бұрын
+Joshua Wakhata not yet but will add to my list
@aravindkumar5129
@aravindkumar5129 6 жыл бұрын
U didn't say about peek method
@nayakdevi6880
@nayakdevi6880 6 жыл бұрын
i want to know about keep and peek method
@johnsongeorge5906
@johnsongeorge5906 6 жыл бұрын
Very Good Bro
@narendarsingh4672
@narendarsingh4672 6 жыл бұрын
great
@reyaadelkomy8046
@reyaadelkomy8046 6 жыл бұрын
Thanks
@vito2320
@vito2320 6 жыл бұрын
You are doing great job. I like your videos :)
@aapkanigam
@aapkanigam 6 жыл бұрын
+Vito23 thanks keep learning and sharing
@navzme
@navzme 6 жыл бұрын
Thanks for awesome video
@aapkanigam
@aapkanigam 6 жыл бұрын
Thanks ..keep learning and sharing
@mohamedmostafa3921
@mohamedmostafa3921 6 жыл бұрын
thank you ashish
@aapkanigam
@aapkanigam 6 жыл бұрын
Keep learning and sharing
MVC Video :- Difference between viewdata,viewbag,tempdata and session.(MVC Interview questions)
18:50
РОДИТЕЛИ НА ШКОЛЬНОМ ПРАЗДНИКЕ
01:00
SIDELNIKOVVV
Рет қаралды 2,8 МЛН
Players vs Corner Flags 🤯
00:28
LE FOOT EN VIDÉO
Рет қаралды 78 МЛН
Part 9- Razor View Engine in MVC | Asp.net MVC Razor Syntax
16:20
Technotips Ashish
Рет қаралды 32 М.
MVC : RenderBody and RenderSection .NET C#
8:09
Tek Tuition
Рет қаралды 4,2 М.
ViewBag, ViewData, TempData, Session in MVC | Asp.net MVC | Tamil
15:31
Why ASP.NET MVC and MVC vs WebForms ? ( Learn MVC  5 series)
28:57
.NET Interview Preparation videos
Рет қаралды 249 М.
Part 4- MODEL Binding in ASP.NET MVC (Model-View-Controller)
13:23
Technotips Ashish
Рет қаралды 77 М.
7.TempData , Peek and Keep - ASP NET MVC 5 - CodeGPT
10:22
CodeGPT
Рет қаралды 2,5 М.
РОДИТЕЛИ НА ШКОЛЬНОМ ПРАЗДНИКЕ
01:00
SIDELNIKOVVV
Рет қаралды 2,8 МЛН