What is the difference between Partial View and Layout?
asp.net-mvc, c#, razor
Solution
In addition to Josh's answer, my aweeeesomeee paint skills would like to draw you a picture that should explain all..
Admit it... you're in awe...
You see the header and footer... you could even have partial view's there too.
EDIT...
Layout
To give you a different example of why you use each component (layout / view / partial view), imagine that you own a website that has 100 pages in total, and lets say you want to update the design of your website, how are you going to do it?
Updating each page individually would drive me insane, because your replicating your code constantly for every single page, just to update your design.
This is what the Layout view helps you solve, you use the Layout view to create a template for all of your pages.
View
Using our existing scenario of 100 page website, each page is going to have content that is unique, the View allows us to display this content whilst using our template from the `Layout`.
Partial View
Now lets imagine that we allow our visitors to comment on our pages, each comment must look consistent, and behave exactly the same as all the other comments throughout our website... To achieve this, you would use a `Partial View` which would act as a template for the comments that you receive on your website.
The benefits of doing this is that you don't have to repeat your code everywhere, you only have to create one `Partial View` to render any comment.
Problem
I had used both the Partial View and also the Layout Concept in my Project i cannot able to differentiate. But what i am feeling is both doing the same work. Can anyone tell the brief idea about the Partial View and Layout and difference with example?