Skip to content

Add example that sets a render mode programatically #31403

@guardrex

Description

@guardrex

Description

This is a second example, and it's better for a new section on render mode by area. The example can show setting the render mode by path ...

<Routes @rendermode="@RenderModeForPage" />

...

[CascadingParameter]
private HttpContext HttpContext { get; set; } = default!;

private IComponentRenderMode? RenderModeForPage => 
    HttpContext.Request.Path.StartsWithSegments("/Admin") ? InteractiveServer : null;

Page URL

https://learn.microsoft.com/en-us/aspnet/core/blazor/components/render-modes?view=aspnetcore-8.0

Content source URL

https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/blazor/components/render-modes.md

Document ID

7c9948a3-9886-8097-6014-492a4c21ea4e

Article author

@guardrex

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions