blazor

onChange event not firing Blazor InputSelect

天涯浪子 提交于 2020-05-16 03:21:06
问题 I have the following Code for an InputSelect <InputSelect class="form-control form-control form-control-sm" placeholder="Role" disabled="@IsReadOnly" @bind-Value="Model.Role" @onchange="@RoleChanged"> <option value="Member">Member</option> <option value="Admin">Admin</option> <option value="Pioner">Pioneer</option> <option value="Retailer">Retailer</option> </InputSelect> And for the Code: bool ShowCreated; bool ShowUpdated; bool IsReadOnly; string SelectedRole; public EditForm AccountForm;

Blazor Adding HttpClientHandler to add Jwt to HTTP Header on requests

泪湿孤枕 提交于 2020-05-15 04:08:51
问题 I am using the Visual Studio 2019 and .Net Core 3.0.0-preview-7 with the standard Blazor Client, Server and Shared templates. In the application our server side WebApi application will always require a JWT token to be present in the header for authorization. From looking at the following Make HTTP requests using IHttpClientFactory in ASP.NET Core I created the following handler; public class JwtTokenHeaderHandler : DelegatingHandler { private readonly ILocalStorageService _localStorage;

Blazor Adding HttpClientHandler to add Jwt to HTTP Header on requests

点点圈 提交于 2020-05-15 04:03:11
问题 I am using the Visual Studio 2019 and .Net Core 3.0.0-preview-7 with the standard Blazor Client, Server and Shared templates. In the application our server side WebApi application will always require a JWT token to be present in the header for authorization. From looking at the following Make HTTP requests using IHttpClientFactory in ASP.NET Core I created the following handler; public class JwtTokenHeaderHandler : DelegatingHandler { private readonly ILocalStorageService _localStorage;

ASP.Net Core Blazor: How to load different _Host.cshtml files based on header value

不想你离开。 提交于 2020-05-13 19:24:08
问题 I would like to load a _Host.cshtml file in an ASP.NET Core Blazor project (Server side Blazor) based on a header in the request. For example: A client connects to example.com and is redirected to a _Host.cshtml file specific for tenant A. Another client connects to test.com and is redirected to a _Host.cshtml file specific for tenant B. The _Host.cshtml file looks somehow like this: @page @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers <!DOCTYPE html> <html lang="en" dir="ltr"> <head>

Select box binding in blazor

谁都会走 提交于 2020-05-13 06:41:31
问题 I am trying to bind "CountryId" in the model to the value of a selected item of SelectList in blazor. All of the Country items come in a list like {CountryId, CountryName} object. I do the code like so: <InputSelect @bind-Value="model.ByCountryId" class="form-control"> @if (model?.Countries != null) { @foreach (var cnt in model.Countries) { <option value="@cnt.Id">@cnt.Name</option> } } </InputSelect> And code block: @code { BrandModel model = new BrandModel(); protected override async Task

How to fix 'The current thread is not associated with the renderer's synchronization context'?

戏子无情 提交于 2020-05-13 04:54:14
问题 I am trying to change change a string, being used for a title, in my blazor-server-side application. But I am having trouble getting the UI to update. I tried using StateHasChanged(), but that didn't work so I looked around and found that on the FlightFinder Demo that was made, it has an OnChange event Action, so I am trying to implement that. It works until I try to refresh the browser, then I am hit with this error System.InvalidOperationException: 'The current thread is not associated with

How to fix 'The current thread is not associated with the renderer's synchronization context'?

佐手、 提交于 2020-05-13 04:53:51
问题 I am trying to change change a string, being used for a title, in my blazor-server-side application. But I am having trouble getting the UI to update. I tried using StateHasChanged(), but that didn't work so I looked around and found that on the FlightFinder Demo that was made, it has an OnChange event Action, so I am trying to implement that. It works until I try to refresh the browser, then I am hit with this error System.InvalidOperationException: 'The current thread is not associated with

How to fix 'The current thread is not associated with the renderer's synchronization context'?

二次信任 提交于 2020-05-13 04:53:08
问题 I am trying to change change a string, being used for a title, in my blazor-server-side application. But I am having trouble getting the UI to update. I tried using StateHasChanged(), but that didn't work so I looked around and found that on the FlightFinder Demo that was made, it has an OnChange event Action, so I am trying to implement that. It works until I try to refresh the browser, then I am hit with this error System.InvalidOperationException: 'The current thread is not associated with

blazor.server.js file not found

你。 提交于 2020-05-13 03:26:58
问题 I created a new ASP.NET Core 3.0 Web application and selected the Model-View-Controller option. I wanted to add Blazor Server side, so I added the below to the Startup.cs file. services.AddServerSideBlazor(); endpoints.MapBlazorHub(); and added the script file <script src="_framework/blazor.server.js"></script> in my Layout file. I created a simple component that displays what I enter in a textbox, and added the component to my Index.cshtml view. It works within Visual Studio, but when I push

Blazor EditContext doesn't trigger FieldState

心已入冬 提交于 2020-05-12 07:18:19
问题 When values change in the Form Component. The Editform does not validate and it does not set the IsModified of the FieldState to true. Only on submit it will validate. I see when the values change, the class "Modified" is not added the input tag in HTML. So it looks like the EditContext is not setting the FieldState? How can I achieve that? Many thanks! Code (Simplified): Form Component @typeparam TItem <EditForm EditContext="_editContext" OnValidSubmit="OnValidSumit">