How to enable/disable inputs in blazor

To disable elements you should use the disabled attribute. I’ve modified your code a bit and this will do what you’re after. Blazor will automatically add or remove the disabled attribute based on the IsDisabled value. You should use the disabled attribute on your button as well. It’s a much better practice. <button type=”button” disabled=”@IsDisabled”></button> … Read more

Blazor: How to use the onchange event in when using @bind also?

@bind is essentially equivalent to the having both value and @onchange, e.g.: <input @bind=”CurrentValue” /> Is equivalent to: <input value=”@CurrentValue” @onchange=”@((ChangeEventArgs e) => CurrentValue = e.Value.ToString())” /> Since you’ve already defined @onchange, instead of also adding @bind, just add value to prevent the clash: <select value=”@SelectedCustID” @onchange=”@CustChanged” class=”form-control”> @foreach (KeyGuidPair i in CustList) { <option … Read more

Why does page not update after refresh when .cshtml changes

After Asp.net Core 3.0, Runtime compilation is enabled using the Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation package. To enable runtime compilation, apps must: Install the Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation NuGet package. Update the project’s Startup.ConfigureServices method to include a call to AddRazorRuntimeCompilation: services .AddControllersWithViews() .AddRazorRuntimeCompilation(); or services.AddMvc().AddRazorRuntimeCompilation();

Blazor vs Razor

The information I am presenting below is mostly paraphrased from Steven Anderson’s Feb. 2 Blog entry and my own understanding of the goals for the project: Blazor is intended to combine ideas from the current .NET Razor stack with modern SPA framework architecture. Code creation is intended to be flexible and encourages component-based layouts, as … Read more

NavigationManager – Get current URL in a Blazor component

Use the Uri property from the NavigationManager class. How it works Get it from injection before using it on .razor pages: @inject NavigationManager MyNavigationManager Or like this in a .cs file if you prefer the “code-behind” experience: using Microsoft.AspNetCore.Components; // … [Inject] public NavigationManager MyNavigationManager {get; set;} = default!; Sample @page “/navigate” @inject NavigationManager MyNavigationManager … Read more

What’s the difference between ASP.NET Core Hosted and Server-Side Blazor, really?

Re this part of your question: However, there’s a third option: dotnet blazorwasm –hosted (or dotnet blazor –hosted) It’s the same as check box in Visual Studio when creating application: The documentation says: you have the option of configuring the app to use an ASP.NET Core backend by selecting the ASP.NET Core hosted check box … Read more

Blazor performance

Is it true that the browser will need to download the WebAssembly library every time the page loads? No, browsers can cache the files. Common CDNs for Blazor applications will do the trick. Is this system faster to work than, for example, React / Vue.js, compiled in JavaScript? Blazor uses WebAssembly, On paper WebAssembly should … Read more