How to set correctly RadzenSwitch render mode .net 8?

Hello i am struggling to figure out how to make. RadzenSwitch work correctly with default .net 8 blazor template.

I have tried to add different components like

<RadzenComponents @rendermode="@RenderMode.InteractiveServer" />
<RadzenNotification @rendermode="@RenderMode.InteractiveServer" />
<RadzenContextMenu @rendermode="@RenderMode.InteractiveServer" />
<RadzenTooltip @rendermode="@RenderMode.InteractiveServer" />
<RadzenDialog @rendermode="@RenderMode.InteractiveServer" />

or directly setting render mode for component

<RadzenSwitch @bind-Value=@value @rendermode="@RenderMode.InteractiveServer" />

gets error NotSupportedException: Serialization and deserialization of 'System.Type' instances is not supported.

I know it is a render mode issue because when i enable.

 <Routes @rendermode="InteractiveServer" />

switch starts working, but it breaks other pages like default login.razor.

What should be the correct way to fix this?

Hi @Mr.Alnis,

Indeed not all components can have a @rendermode property set. The workaround is to use a helper component. More info available in the Blazor documentation.

1 Like