You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I notice that the HxSelect component not work in static server render mode. (I did not test other components.)
Reproduce code as below, click the submit button after run.
@page "/Demo"
@using System.ComponentModel.DataAnnotations<EditForm Model="@Model" OnValidSubmit="@HandleSubmit" FormName="demo_form"><DataAnnotationsValidator/><HxSelect
Label="Band member"
Data="@_people"
@bind-Value="@Model.SelectedPersonInitials"TextSelector="@(p => p.Name)"ValueSelector="@(p => p.Initials)"Nullable="true"NullText="-select name-"NullDataText="Loading band members..."/><HxSubmit Text="Submit" Color="ThemeColor.Primary"/></EditForm>@code{[SupplyParameterFromForm]privateFormModel Model {get;set;}=new();
private readonly List<Person>_people=[newPerson("John Lennon", "JL"),newPerson("Paul McCartney","PM"),newPerson("George Harrison","GH"),newPerson("Ringo Starr","RS")];
internal class FormModel
{[Required(ErrorMessage="Choose a band member.")]publicstring SelectedPersonInitials {get;set;}}record Person(stringName,stringInitials);
private voidHandleSubmit(){Console.WriteLine("Submit");
Console.WriteLine($"Selected person: {Model.SelectedPersonInitials}");}}
error info:
System.InvalidOperationException: Data does not contain item for current value '0'.
at Havit.Blazor.Components.Web.Bootstrap.HxSelectBase`2.RefreshState()
at Havit.Blazor.Components.Web.Bootstrap.HxSelectBase`2.BuildRenderInput(RenderTreeBuilder builder)
at Havit.Blazor.Components.Web.Bootstrap.HxInputBase`1.Havit.Blazor.Components.Web.Bootstrap.Internal.IFormValueComponent.RenderValue(RenderTreeBuilder builder)
at Havit.Blazor.Components.Web.Bootstrap.Internal.HxFormValueComponentRenderer.BuildRenderValue(RenderTreeBuilder builder)
at Havit.Blazor.Components.Web.Bootstrap.Internal.HxFormValueComponentRenderer.BuildRenderInputGroups(RenderTreeBuilder builder, RenderFragment content)
at Havit.Blazor.Components.Web.Bootstrap.Internal.HxFormValueComponentRenderer.BuildRenderTree(RenderTreeBuilder builder)
at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment renderFragment, Exception& renderFragmentExceptio
n)
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Components.RenderTree.Renderer.ProcessRenderQueue()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Components.RenderTree.Renderer.ProcessRenderQueue()
at Microsoft.AspNetCore.Components.RenderTree.Renderer.AddToRenderQueue(Int32 componentId, RenderFragment renderFragment)
at Microsoft.AspNetCore.Components.ComponentBase.StateHasChanged()
at Microsoft.AspNetCore.Components.ComponentBase.CallOnParametersSetAsync()
at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()
at Microsoft.AspNetCore.Components.Rendering.ComponentState.SetDirectParameters(ParameterView parameters)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.RenderRootComponentAsync(Int32 componentId, ParameterView initialParameters)
at Microsoft.AspNetCore.Components.HtmlRendering.Infrastructure.StaticHtmlRenderer.BeginRenderingComponent(IComponent component, ParameterView initialParameters)
at Microsoft.AspNetCore.Components.Endpoints.EndpointHtmlRenderer.RenderEndpointComponent(HttpContext httpContext, Type rootComponentType, ParameterView parameters, Boolean
waitForQuiescence)
at Microsoft.AspNetCore.Components.Endpoints.RazorComponentEndpointInvoker.RenderComponentCore(HttpContext context)
at Microsoft.AspNetCore.Components.Endpoints.RazorComponentEndpointInvoker.RenderComponentCore(HttpContext context)
at Microsoft.AspNetCore.Components.Rendering.RendererSynchronizationContext.<>c.<<InvokeAsync>b__10_0>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Antiforgery.Internal.AntiforgeryMiddleware.InvokeAwaited(HttpContext context)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)
The text was updated successfully, but these errors were encountered:
I notice that the HxSelect component not work in
static server render mode
. (I did not test other components.)Reproduce code as below, click the submit button after run.
error info:
The text was updated successfully, but these errors were encountered: