Wednesday, September 2, 2020

Why we need Partial Views in ASP.NET MVC Application?

When we need a common part of the user interface at multiple pages in a web application then we develop a partial view, hence the partial view is a regular view that can be used multiple times in an application and has the file extension .cshtml.

Sometimes we also use a partial view to divide a web page into small parts such as header, footer, and menu on Layout. Other examples are comments in blogging site, shipping and billing address in the invoice in e-commerce site, etc. 

If you are coming from asp.net web-forms background, then you can realize that partial views in MVC are similar to user controls in asp.net web forms.