Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Blazor render-mode="Server" for displaying the component not working

I am trying to display a blazor component from a razor page by setting render-mode="Server" but it is not displaying the component. That is the below code is not working.

<component type="typeof(BlazorRC.Pages.SelectCity)" render-mode="Server" />

However when I change it to render-mode="ServerPrerendered" then the component displays. That is the below code works.

<component type="typeof(BlazorRC.Pages.SelectCity)" render-mode="ServerPrerendered" />

Why is this happening?? What should I do to make render-mode="Server" to work??

like image 899
yogihosting Avatar asked Oct 30 '25 22:10

yogihosting


1 Answers

I solved this problem by adding blazor.server.js script link after calling the component in the Razor Page.

<component type="typeof(BlazorRC.Pages.SelectCity)" render-mode="Server" />

<script src="_framework/blazor.server.js"></script>

Note that render-mode="ServerPrerendered" does not need the blazor.server.js.

like image 182
yogihosting Avatar answered Nov 02 '25 22:11

yogihosting