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

后端 未结 6 1599
粉色の甜心
粉色の甜心 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:54

    Look at StackOverflow.com site: Main site (View) contains components like:

    • Tags
    • Related
    • Ad

    So Tags, related, Ad etc. can be composed as PartialViews. The advantage of this is that PartialViews can be simply cached by OutputCache instead of recreating all site: performance gain.

提交回复
热议问题