Conditionally include partial view in ASP.NET Core

added by DotNetKicks
4/2/2019 6:39:25 AM

2 Kicks, 215 Views

I have ASP.NET Core web application where I need to include partial view only if it exists. The application uses areas and some areas may have their specific side menu. This blog post shows two ways how to conditionally include partial view to ASP.NET Core layout page.