Hi @Nigel ,
However, although although the text input boxes show, all the data binding to objects stops working.
I checked your code, not only the data binding but also the button click event also not work, right?
To solve this issue, you need to change these parts:
- Change the Render Mode from
Static
toServerPrerendered
: because when using the static mode, it will render the component into static HTML. <component type="typeof(Components.Name1)" render-mode="ServerPrerendered" /> - In the Program.cs file, add the MapBlazorHub middleware and AddServerSideBlazor service:
builder.Services.AddServerSideBlazor(); app.MapBlazorHub();
- In the _Layout.cshtml page, add the
_framework/blazor.server.js
script reference: - In the Name1 component, add the
Microsoft.AspNetCore.Components
andMicrosoft.AspNetCore.Components.Web
reference:
Then the result as below:
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Best regards,
Dillion