OnChangeEventWithSelectDropdown: retarget net10.0, fix @foreach compile bug, add InputSelect example - #2088
Merged
CodeMazeBlog merged 1 commit intoAug 13, 2026
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 plainforeachis required - neither method compiled as published.HandleChangerewritten to a TryParse guard + FirstOrDefault lookup. Adds a fourth topping select usingInputSelectinsideEditFormwith@bind-Value:afterfor the article's new section on handling InputSelect changes without losing the binding.