Skip to content

OnChangeEventWithSelectDropdown: retarget net10.0, fix @foreach compile bug, add InputSelect example - #2088

Merged
CodeMazeBlog merged 1 commit into
CodeMazeBlog:mainfrom
vladimir-pecanac-main:seo/96081-blazor-onchange-inputselect
Aug 13, 2026
Merged

OnChangeEventWithSelectDropdown: retarget net10.0, fix @foreach compile bug, add InputSelect example#2088
CodeMazeBlog merged 1 commit into
CodeMazeBlog:mainfrom
vladimir-pecanac-main:seo/96081-blazor-onchange-inputselect

Conversation

@vladimir-pecanac-main

Copy link
Copy Markdown
Collaborator

Retargets the sample to net10.0 (WebAssembly packages 10.0.10, test stack MSTest 4.3.3 / bunit 1.40.0). Fixes a compile bug: @foreach (Razor markup syntax) was used inside two C# method bodies (HandleChange, CalculateGrandTotal) where plain foreach is required - neither method compiled as published. HandleChange rewritten to a TryParse guard + FirstOrDefault lookup. Adds a fourth topping select using InputSelect inside EditForm with @bind-Value:after for the article's new section on handling InputSelect changes without losing the binding.

…le bug, add InputSelect example

Bumped WebAssembly packages to 10.0.10, test stack to MSTest 4.3.3 / bunit 1.40.0.

@foreach (Razor markup syntax) was used inside two C# method bodies
(HandleChange, CalculateGrandTotal) where plain foreach is required -
neither method compiled as published. Fixed both.

HandleChange rewritten to a TryParse guard + FirstOrDefault lookup instead
of a loop-and-compare over an unchecked int.Parse(args.Value.ToString()).

Added a fourth topping select using InputSelect inside EditForm with
@bind-Value:after, demonstrating the pattern for handling changes on an
InputSelect without losing the binding.
@CodeMazeBlog
CodeMazeBlog merged commit 84608b9 into CodeMazeBlog:main Aug 13, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants