locked
How to disable blazor default layout? RRS feed

  • Question

  • User887623398 posted

    Hello,

    How to disable blazor default layout?

    Like ASp.net core:

      @{
        Layout = null
      }

    thanks,

    Friday, August 14, 2020 10:29 AM

Answers

  • User475983607 posted

    SaeedP

    How to disable blazor default layout?

    According to the docs you can set the layout to whatever you like; https://docs.microsoft.com/en-us/aspnet/core/blazor/layouts?view=aspnetcore-3.1

    Just create an empty component with the following lines of code.  Name the component EmptyLayout.razor.

    @inherits LayoutComponentBase
    @Body

    Then reference the EmptyLayout component in your Blazor page.

    @layout EmptyLayout
    @page "/htmlsnippet"
    <h3>HtmlSnippet</h3>
    
    @code {
    
    }
    

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, August 14, 2020 12:57 PM

All replies

  • User475983607 posted

    SaeedP

    How to disable blazor default layout?

    According to the docs you can set the layout to whatever you like; https://docs.microsoft.com/en-us/aspnet/core/blazor/layouts?view=aspnetcore-3.1

    Just create an empty component with the following lines of code.  Name the component EmptyLayout.razor.

    @inherits LayoutComponentBase
    @Body

    Then reference the EmptyLayout component in your Blazor page.

    @layout EmptyLayout
    @page "/htmlsnippet"
    <h3>HtmlSnippet</h3>
    
    @code {
    
    }
    

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, August 14, 2020 12:57 PM
  • User887623398 posted

    Thank you mgebhard.

    Friday, August 14, 2020 9:35 PM