Reputation: 3454
Just curious if there was anything that made a partial view different from a regular view other than convention.
Code-wise they look and work similar but I was curious if there was a difference (other than specifying the template page, etc at the top).
Upvotes: 27
Views: 11647
Reputation: 994
Maybe "PartialView" are generally clubbed with [ChildActionOnly] so that it is used in man page by invoking actions using HTMl.Action etc.
Upvotes: 0
Reputation: 93424
If you're using Razor, there is no real difference between a partial view and a view, they're both cshtml files. A view is a view. If you want to use a view as a partial view, then there are some restrictions, such as not using a Layout file.
In WebForms View engine, a partial view is typically an ascx, versus an aspx. There are some subtle differences there in the definitions, but they're still largely interchangeable.
Partial versus full is all about the way it's used. If you return the view in a View() method, it's a full view. If you return it in a Partial, then it's a partial.
Upvotes: 19