Disable layout for page under Blazor

In my Blazor-server-side project, i resolved this issue with following two steps.

Step 1: First create a new empty razor component named EmptyLayout.

EmptyLayout.razor

@inherits LayoutComponentBase

<div class="main">    
    <div class="content px-4">
        @Body
    </div>
</div>

Step 2, To set Layout=null, I use the below code in the top of all required pages

@layout EmptyLayout

Leave a Comment