My deployed Blazor application only shows “Loading…” Why is the deployed Blazor application not working?
You must update the virtual app path or app base path in index.html to resolve this issue. That is, the hosted application expects the assets from root folder of the web server. So, you have to update the subfolder name in index.html to serve the files from the path. For example, if I am hosting an application in http://example.com/blazor/, the index.html looks like the following. For more information, refer to this link for updating app-base-path.
How do I get event data in Blazor?
Blazor provides a set of event argument types that map to events. By using this event argument types we can get the event data for the specific event. For example, you need to use KeyboardEventArgs to get the event data for the keypress event in the input element for every key press. Refer to this Visual Studio Magazine link for more events and event args.
How can you read the current value of an input element in Blazor?
The value of an input element is updated in the wrapper with the change events of elements in Blazor. To get the current value for each character input, you must use the oninput event of the input element. This can be achieved by binding the oninput event (native event) using the @bind:event=“oninput“.
How do I pass arguments to the onclick event in Blazor?
You can use a lambda expression to pass multiple arguments to an onclick event.
I’m getting this issue: the type or namespace name ‘Mvc’ does not exist in the namespace ‘Microsoft.AspnetCore’ (are you missing an assembly reference?).
While upgrading Blazor applications, you many encounter these issues. You have to do the following changes to properly run the application: Update all Microsoft.AspNetCore.Blazor.* package references to 3.0.0-preview4-19216-03. Remove any package reference to Microsoft.AspNetCore.Components.Server. Remove any DotNetCliToolReference to Microsoft.AspNetCore.Blazor.Cli and replace with a package reference to Microsoft.AspNetCore.Blazor.DevServer. In client Blazor projects, remove the <RunCommand>dotnet</RunCommand> and <RunArguments>blazor serve</RunArguments> properties. In client Blazor projects, add the <RazorLangVersion>3.0</RazorLangVersion> property. Rename all _ViewImports.cshtml files to _Imports.razor. Rename all remaining .cshtml files to .razor. Rename components.webassembly.js to blazor.webassembly.js Remove any use of the Microsoft.AspNetCore.Components.Services namespace and replace with Microsoft.AspNetCore.Components as required. Update server projects to use endpoint routing. Run dotnet clean on the solution to clear out old Razor declarations. Reference link : Go through the upgrade section https://devblogs.microsoft.com/aspnet/blazor-now-in-official-preview/. You can also check this thread for more information.