blazor

Blazor InputText call async Method when TextChanged

白昼怎懂夜的黑 提交于 2021-02-09 10:30:33
问题 I try to capture text changes of InputText in Blazor (ServerSide) and then call a async method to check if input is correct coupon code or not. HTML: <EditForm Model="@Basket" OnValidSubmit="@CommitBasket"> Gutscheincode <InputText class="coupon-input checkout-control pristine untouched" @bind-Value="CouponCode" @onchange="CouponCodeChanged"> </InputText> @CouponText </EditForm>` But The CouponCodeChanged isn't raised - OnKeyUp is not useful because the Text Value isn't changed at that state.

In Blazor, How to @bind and then fire @onchange in a dynamic model

给你一囗甜甜゛ 提交于 2021-02-09 07:22:40
问题 Model: public class FiltersModel { public CheckBoxListWithTitle Brand { get; set; } } public class CheckBoxListWithTitle { public List<FilterCheckBox> CheckBoxes { get; set; } } public class FilterCheckBox { public string Value { get; set; } public bool Checked { get; set; } } Razor: @foreach (var item in Model.Brand.CheckBoxes) { <label> @item.Value <input type="checkbox" @onchange="@FilterChangedBrand" /> </label> } @code: public FiltersModel Model { get; set; } // Initialized in

Blazor format an InputType of Numeric

送分小仙女□ 提交于 2021-02-08 11:13:06
问题 Would anyone know how to format a Numeric type to look like 100.10? Currently if the value is 100.10 it will display as 100.1 tried @bind-value:format with C2, 0:0.##, I'm new to Blazor so if anyone could point me in the right direction it would be appreciated. <BSBasicInput InputType="InputType.Number" @bind-Value="@Amount" step="0.01" /> 回答1: If you bind to a decimal it seems it will keep the number of decimals you specify for the value, even training zeros. @page "/" <EditForm Model=

Blazor format an InputType of Numeric

会有一股神秘感。 提交于 2021-02-08 11:12:03
问题 Would anyone know how to format a Numeric type to look like 100.10? Currently if the value is 100.10 it will display as 100.1 tried @bind-value:format with C2, 0:0.##, I'm new to Blazor so if anyone could point me in the right direction it would be appreciated. <BSBasicInput InputType="InputType.Number" @bind-Value="@Amount" step="0.01" /> 回答1: If you bind to a decimal it seems it will keep the number of decimals you specify for the value, even training zeros. @page "/" <EditForm Model=

How to show a list of information on the fly in a razor component

和自甴很熟 提交于 2021-02-08 07:22:46
问题 I have a database and a lot of entries in a table. I want to show those entries on a webpage, using blazor. I have tried loading the entries using context.tableName.Load() and context.tableName.Local and iterating through the entries using @foreach(var entry in localList){ <p>@entry.Name</p> } That works fine.. but it first loads all the data from the database and when it finally has finished, it starts rendering the page/results. I want to show the results that have been loaded immediately,

Blazor Chrome caching issues

时光怂恿深爱的人放手 提交于 2021-02-08 05:55:12
问题 I have this Blazor SPA I have published to IIS on a webhotel. My problem is that Chrome is somehow caching my Blazor assembly so no matter how many times I redeploy I still get the old dll. I can start up a new clean Chrome with chrome --disable-application-cache --incognito and that does indeed get the fresh dll but how do I fix this properly? Kind regards 回答1: The following helps IF you don't want PWA features. I started my project with PWA (just in case I wanted it later) but it turned out

Is there a way to serve a Blazor app from a specific controller action in a MVC app?

倾然丶 夕夏残阳落幕 提交于 2021-02-08 05:13:40
问题 I'd like to set up a controller action in a already existing ASP.NET Core 3.0 MVC project to serve a Blazor app. I've seen something similar with other SPA frameworks in the past, the View for the action just includes contains the script tag with the bundle, there's usually some other setup like having the SPA build placed on wwwroot for the MVC project. Looking at the Blazor app it seems similar to some extent, where the index.html file includes the wasm script. But I'm honestly not sure

Blazor: binding to a MultiSelectList (ideally with a checkbox)

此生再无相见时 提交于 2021-02-07 06:48:43
问题 Experimenting with Blazor (Server, if that makes any difference), and I'm having difficulty getting binding to a MultiSelectList to work.... Bit of background: I'm dealing with EF Core and have a Many-to-Many relationship, let's say between people and cars. I'm currently loading a page that shows the existing details, and allowing the user to update this page. So in my Service, I load my Person entity from the DB, and this includes the details of all the cars they currently own. I also load

SignalR Hub Authorization for Blazor WebAssembly with Identity

人走茶凉 提交于 2021-02-07 03:49:04
问题 I have set up a SignalR Blazor WebAssembly app with JWT authentication, configured to send the token through query field access_token. At the server, I see that it is assigning the context.Token from this value. However, for the hub, annotated with [Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)], I am getting 401. Why is it not authorizing? This is the code for the hub: https://github.com/jonasarcangel/SignalRAuthTest/blob/master/SignalRAuthTest/Server/SignalR

SignalR Hub Authorization for Blazor WebAssembly with Identity

六眼飞鱼酱① 提交于 2021-02-07 03:46:51
问题 I have set up a SignalR Blazor WebAssembly app with JWT authentication, configured to send the token through query field access_token. At the server, I see that it is assigning the context.Token from this value. However, for the hub, annotated with [Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)], I am getting 401. Why is it not authorizing? This is the code for the hub: https://github.com/jonasarcangel/SignalRAuthTest/blob/master/SignalRAuthTest/Server/SignalR