Blazor form component InputSelect should support binding of type Guid
See original GitHub issueIs your feature request related to a problem? Yes.
Following code does not work if binding Type is Guid. The runtime error in browser console is `InputSelect does not support the type Guid"
// ItemCreate.razor
...
<InputSelect bind-Value="Item.CategoryId">
@foreach(var cat in Categories) {
<option value="cat.Id">@cat.Name</option>
}
</InputSelect>
...
// Entities.cs
...
public class Item
{
public Guid Id { get; set; }
public string Name { get; set; }
public virtual Category Category { get; set; }
[ForeignKey("Category")]
public Guid? CategoryId { get; set; }
}
public class Category
{
public Guid Id { get; set; }
public string Name { get; set; }
}
...
Describe the solution you’d like
InputSelect should support binding for type Guid.
Describe alternatives you’ve considered
I have to create custom MyInputSelect on top of InputSelect which supports Guid.
Additional context
Asp.Net Core 3 Preview 4
Browser: Chrome @version:73
Issue Analytics
- State:
- Created 4 years ago
- Reactions:14
- Comments:13 (2 by maintainers)
Top Results From Across the Web
InputSelect does not support the type System.Int32
This is one of the common error you will encounter when binding a select element to integer. Blazor Select Example. InputSelect does not...
Read more >ASP.NET Core Blazor data binding
This article explains data binding features for Razor components and DOM elements in Blazor apps. Razor components provide data binding ...
Read more >How to make InputSelect support more types
If you have used InputSelect in Blazor in ASP.NET Core 3.1 you may have noticed bind-Value only works on a limited set of...
Read more >Create an InputSelect component that accepts lists with ...
My goal is to send a list of any type to InputSelect while @typeparam is used for binding. c# · asp.net-core · blazor...
Read more >Blazor Binding Support Multiple Options For - 'Select' ...
In this article, we will explore the blazor application binding support multiple options for the 'Select' or 'InputSelect' which is .
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Guid (or UUID) is used by every modern web app on the face of the planet. It should have first class support everywhere it’s possible to use it.
Currently this has to be worked around by adding redundant properties to your model and explicitly invoking Convert on the getter and setter every time you want to use InputSelect based on an object’s Guid.
`
`
This is frustrating and tedious. Not Blazing!
I am really curious about the thought process behind only supporting string and enum. It is obvious to me that the integer types, guid and their nullable versions should also be supported