Explain what is the difference between View and Partial View?

Category: C SharpExplain what is the difference between View and Partial View?
Editor">Editor Staff asked 2 years ago

Explain what is the difference between View and Partial View?

1 Answers
Editor">Editor Staff answered 2 years ago

View

  • It contains the layout page.
  • Before any view is rendered, viewstart page is rendered.
  • A view might have markup tags like body, HTML, head, title, meta etc.
  • The view is not lightweight as compare to Partial View.

Partial View

  • It does not contain the layout page.
  • Partial view does not verify for a viewstart.cshtml.We cannot put common code for a partial view within the viewStart.cshtml.page.
  • Partial view is designed specially to render within the view and just because of that it does not consist any mark up.
  • We can pass a regular view to the RenderPartial method.