Skip to content

Blazor Layouts with several placeholders (Header/Footer/etc) like MVC Sections/WebForms #10131

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
chrdlx opened this issue May 10, 2019 · 2 comments
Labels
area-blazor Includes: Blazor, Razor Components Needs: Design This issue requires design work before implementating.

Comments

@chrdlx
Copy link

chrdlx commented May 10, 2019

What I'm trying to achieve is a component like this:

@inherits LayoutComponentBase
<div>
   Here some html from the layout's header...
  @ExtraHeader

   Here will be the child body: 

   @Body

   Now some footer... 
   @ExtraFooter
   Some more footer...
</div>

Suppose I want to dedicate that @extraheader and @ExtraFooter to be implemented by all the children who use this layout that need to. Is this possible in Blazor right now somehow?

I know we have @Body, but that only supports nesting, not putting content in other places like MVC Sections.
You could do that too in webforms with something like this inside a MasterPage:

<asp:ContentPlaceHolder id="Header" runat="server"></asp:ContentPlaceHolder>
<asp:ContentPlaceHolder id="Body" runat="server"></asp:ContentPlaceHolder>
<asp:ContentPlaceHolder id="Footer" runat="server"></asp:ContentPlaceHolder>

Thanks!

@Eilon Eilon added the area-blazor Includes: Blazor, Razor Components label May 10, 2019
@mkArtakMSFT mkArtakMSFT added this to the 3.0.0-preview7 milestone May 10, 2019
@mkArtakMSFT mkArtakMSFT added the Needs: Design This issue requires design work before implementating. label May 10, 2019
@mkArtakMSFT
Copy link
Member

Thanks for contacting us, @chrdlx.
This is an area we have been debating about quite a bit. We're going to think more about this in the coming future and decide how we move forward from there.

@mkArtakMSFT
Copy link
Member

Closing this in favor of #10452

@ghost ghost locked as resolved and limited conversation to collaborators Dec 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components Needs: Design This issue requires design work before implementating.
Projects
None yet
Development

No branches or pull requests

3 participants