[Blazor] null in select element
Open
affected-few
area-blazor
enhancement
feature-blazor-component-model
feature-rendering
Pillar: Dev Experience
Priority:3
severity-minor
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 276
Description
With regards to this PR: https://github.com/dotnet/aspnetcore/pull/23221
Instead of assuming an empty string and null are the same for an input,...
Would it be possible to set a marker attribute on the when we try to set the value to @null, and in the Blazor code detect that and use null for the `@onchange` event and binding?
`Select one... `
Would generate something like
`Select one... `
Due to HTML limitations we wouldn't be able to have an empty string and a null as available values in the same select, but at least the C# developer won't have to write some code to convert "" to null, and it will "just work".
Contributor guide
Assessment
This issue has not been assessed yet.