What is the difference between a View and a PartialView in ASP.NET MVC?

后端 未结 6 1596
粉色の甜心
粉色の甜心 2020-12-16 09:28

What is the difference between a View and a PartialView in ASP.NET MVC?

At first glance the need for both seems non-obvious to me.

6条回答
  •  [愿得一人]
    2020-12-16 09:43

    Views are the general result of a page that results in a display. It's the highest level container except the masterpage. While a partial view is for a small piece of content that may be reused on different pages, or multiple times in a page.

    If you're coming from webforms, view is similar to a web content form, while a partial view is like a user control.

提交回复
热议问题