blazor-server-side

What's the difference between RenderMode.Server and RenderMode.ServerPrerendered in blazor?

依然范特西╮ 提交于 2020-05-29 03:28:21
问题 What's the difference between @(await Html.RenderComponentAsync<Todo>(RenderMode.ServerPrerendered)) and @(await Html.RenderComponentAsync<Todo>(RenderMode.Server)) I was looking into the documentation but couldn't really find something that explains the difference. and also don't really understand the code comments over the enum stating: // Summary: // Renders a marker for a Blazor server-side application. This doesn't include any // output from the component. When the user-agent starts, it

Execute async method on button click in blazor

浪子不回头ぞ 提交于 2020-05-28 13:42:53
问题 I created a "Razor Components" project. I am trying to execute an asynchronous method when pressing a button, but could not figure out the syntax yet. This is my Index.razor : @page "/" @inject GenericRepository<Person> PersonRepository // ... @foreach (var person in persons) { <button onclick="@(() => Delete(person.Id))">❌</button> } @functions { // ... async void Delete(Guid personId) { await this.PersonRepository.Delete(personId); } } When I click the button, nothing happens. I tried

Execute async method on button click in blazor

蓝咒 提交于 2020-05-28 13:42:39
问题 I created a "Razor Components" project. I am trying to execute an asynchronous method when pressing a button, but could not figure out the syntax yet. This is my Index.razor : @page "/" @inject GenericRepository<Person> PersonRepository // ... @foreach (var person in persons) { <button onclick="@(() => Delete(person.Id))">❌</button> } @functions { // ... async void Delete(Guid personId) { await this.PersonRepository.Delete(personId); } } When I click the button, nothing happens. I tried

HandleRequirementAsync not being called in Auth handler in Blazor app

会有一股神秘感。 提交于 2020-05-28 07:34:40
问题 Im trying to come to grips with using a custom auth handler in a serverside Blazor app. I have a breakpoint in my handler, but its not getting hit. Whats missing? Requirement public class ValidUserRequirement : IAuthorizationRequirement { public bool MustBeValid { get; } public ValidUserRequirement(bool IsValid) { MustBeValid = IsValid; } } Policies public static class Policies { public const string IsValidUser = "IsValidUser"; public static AuthorizationPolicy IsValidUserPolicy() { return

HandleRequirementAsync not being called in Auth handler in Blazor app

跟風遠走 提交于 2020-05-28 07:34:07
问题 Im trying to come to grips with using a custom auth handler in a serverside Blazor app. I have a breakpoint in my handler, but its not getting hit. Whats missing? Requirement public class ValidUserRequirement : IAuthorizationRequirement { public bool MustBeValid { get; } public ValidUserRequirement(bool IsValid) { MustBeValid = IsValid; } } Policies public static class Policies { public const string IsValidUser = "IsValidUser"; public static AuthorizationPolicy IsValidUserPolicy() { return

HandleRequirementAsync not being called in Auth handler in Blazor app

时光总嘲笑我的痴心妄想 提交于 2020-05-28 07:33:45
问题 Im trying to come to grips with using a custom auth handler in a serverside Blazor app. I have a breakpoint in my handler, but its not getting hit. Whats missing? Requirement public class ValidUserRequirement : IAuthorizationRequirement { public bool MustBeValid { get; } public ValidUserRequirement(bool IsValid) { MustBeValid = IsValid; } } Policies public static class Policies { public const string IsValidUser = "IsValidUser"; public static AuthorizationPolicy IsValidUserPolicy() { return

HandleRequirementAsync not being called in Auth handler in Blazor app

大城市里の小女人 提交于 2020-05-28 07:33:31
问题 Im trying to come to grips with using a custom auth handler in a serverside Blazor app. I have a breakpoint in my handler, but its not getting hit. Whats missing? Requirement public class ValidUserRequirement : IAuthorizationRequirement { public bool MustBeValid { get; } public ValidUserRequirement(bool IsValid) { MustBeValid = IsValid; } } Policies public static class Policies { public const string IsValidUser = "IsValidUser"; public static AuthorizationPolicy IsValidUserPolicy() { return

How to reset custom validation errors when using editform in blazor razor page

蓝咒 提交于 2020-05-27 06:26:31
问题 I have an editform using an editcontext: <EditForm OnValidSubmit="HandleValidSubmit" EditContext="_editContext" Context="auth"> <DataAnnotationsValidator /> <input type="time" @bind-value="_foodTruck.EndDelivery" @onkeydown="@(q=>ResetValidation("EndDelivery"))" > <ValidationMessage For="() => _foodTruck.EndDelivery" /> <input type="time" @bind-value="_foodTruck.StartDelivery" @onkeydown="@(q=>ResetValidation("StartDelivery"))" > <ValidationMessage For="() => _foodTruck.StartDelivery" />

Blazor - Cascading Dropdown menu on InputSelect not loading

佐手、 提交于 2020-05-24 05:17:42
问题 I'm trying to load the below table, however, the drop-down menu for the school is not loading. It looks to me like it's null. And I figured that the InputSelect doesn't work with an INT ID yet in Blazor. I filled the below for and the country code was populated from a country table as a lookup based on the country chosen from the InputSelect column, "Country Name", circled in blue. When I select the country, I expect it to load the correspionding countrycode but not the case. Razor Page

Blazor - Cascading Dropdown menu on InputSelect not loading

核能气质少年 提交于 2020-05-24 05:17:25
问题 I'm trying to load the below table, however, the drop-down menu for the school is not loading. It looks to me like it's null. And I figured that the InputSelect doesn't work with an INT ID yet in Blazor. I filled the below for and the country code was populated from a country table as a lookup based on the country chosen from the InputSelect column, "Country Name", circled in blue. When I select the country, I expect it to load the correspionding countrycode but not the case. Razor Page