asp.net-mvc Partial Views

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Introduction

A partial view is a view that is rendered within another view. Partial views can be reused and thus prevent duplication of code. They can be rendered by Html.Partial or Html.RenderPartial

Syntax

  • @Html.Partial("ViewName")

    @Html.Partial("ViewName",ViewModel)

    @{Html.RenderPartial("ViewName");}

    If your partial view is located in a different folder other than shared folder, then you will have to mention full path of the view as below:

    [email protected]("~/Areas/Admin/Views/Shared/partial/_subcat.cshtml")



Got any asp.net-mvc Question?