-
Notifications
You must be signed in to change notification settings - Fork 25.2k
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
RazorComponentResult<T> doesn't render either the Blazor or MVC Layout #31393
Comments
🎉🥳 Happy New Year! 💃🕺A green dinosaur 🦖 will be along shortly to assist. Stand-by ........ |
Hello @nfplee ... Did you try applying a layout directly to the component file. For example something like ... @using BlazorSample.Components.Layout
@layout MainLayout
It doesn't address it, but I don't think we can describe everything that a dev might need to do for all of the different features that might work. I'm not even 100% sure really if the code I just suggested will work or 💥. |
Thanks, I did try that and it then wrapped the component in the content from the MainLayout component but it did not include the content from the App.razor component (the html, head and body tags). |
... not too surprising based on my guess at how they set this feature up. I think the document here will need a little wording to say that only the component is rendered and that every bit of required additional markup (layouts and root component HTML) must also be provided. I'll schedule this for work, and I'll probably ask Mackinnon on the product unit to look over my remarks before publication. Thanks for the issue. Leave this open, as it will close automatically later when the PR merges. |
Thanks, it makes sense it would work this way. I hadn't questioned it until I read this article and figured there might be some magic I might've misunderstood. |
Description
The section Return a RazorComponentResult from an MVC controller action suggests that a Layout will be applied to the Razor component, but I can't get it to work. It simply renders the content of
Welcome.razor
.Page URL
https://learn.microsoft.com/en-us/aspnet/core/blazor/components/integration?view=aspnetcore-8.0
Content source URL
https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/blazor/components/integration.md
Document ID
d7e39bbc-cd54-92aa-4997-f9dd39dd6ef3
Article author
@guardrex
The text was updated successfully, but these errors were encountered: