NavigationError on NavigateTo
There is an open issue on github for this problem. See also the preceeding issue where a possible workaround is mentioned: putting the NavigateTo method into OnAfterRender instead of OnInitialized.
There is an open issue on github for this problem. See also the preceeding issue where a possible workaround is mentioned: putting the NavigateTo method into OnAfterRender instead of OnInitialized.
In .NET5 it will be much simpler: <button @onclick=”() => textInput.FocusAsync()”>Set focus</button> <input @ref=”textInput”/> @code { ElementReference textInput; } NOTE: this feature was introduced in .NET5 Preview 8 so might change until the final release! Also worth mentioning that in .NET5 RC1 JavaScript isolation was introduced via JS Module export/import. So if you still need … Read more
Yes Blazor supports 2 way binding. It works with EventCallbacks (which must be triggered) and default uses name convention based Events e.g.: {PropertyName}Changed. Also you can override this naming convention @bind-{Prop}:event=”{EventCallbackName}”. In your code example you are just overriding this default Event name, never triggering it. In your code you have 2 issues: You MUST … Read more
Note: InputSelect is a component element, not HTML element, which is why you cannot apply to it the @onchange compiler directive. This directive is applied to elements, usually but not necessarily with the value attribute to form the so- called two way data-binding. @bind-Value is a compiler directive directive instructing the compiler to produce code … Read more
I believe that will work… Place the following code snippet in the _Imports.razor file @using Microsoft.AspNetCore.Authorization @attribute [Authorize] In that case, when the Index page is hit, the user will be redirected to the Login page. If you want to perform authentication before the Blazor App is being render, add the code snippet from above … Read more
Explained at ASP.NET Core and Blazor updates in .NET Core 3.0 Preview 9: Static Statically render the component with the specified parameters. Server Render a marker where the component should be rendered interactively by the Blazor Server app. ServerPrerendered Statically prerender the component along with a marker to indicate the component should later be rendered … Read more
The primary difference is where your .NET code is running: with Blazor Server, it’s 100% server-side; with a hosted Blazor WASM application, .NET code is running on both the server and the client (though the server can run any other language or framework you want too). From what I read I understand Blazor Server side … Read more
In the code behind razor.cs file, IJSRunTime or others can be injected with the [Inject] attribute public partial class BillingDashboard { [Inject] IJSRuntime JSRuntime { get; set; } protected override async Task MyFunction() { await JSRuntime.InvokeVoidAsync(“console.log(‘test’)”); } }
I have just implemented a State Container like this and ran into the same error – but my service needs to be a singleton. So I found an example on the aspnetcore git that does exactly what the error message says to do. Call InvokeAsync — not from your state container but when you try … Read more
You were close: <ChildComponent Item=”someModel” T=”SomeModel” DeleteCallback=”OnDeleteSomeModel” /> @code { SomeModel someModel = new SomeModel(); void OnDeleteSomeModel(SomeModel someModel) { … } } The EventCallback uses a generic type and blazor cannot infer it if you don’t pass the type to the component. This means that if you have a EventCallback<T> you need to pass the … Read more