Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

How to bind object to option in Blazor?

$
0
0

I have the following dropdown menu:

public class object {    public other_object apple {get; set;}    ...    public string stuff {get; set;}    ...}public class other_object {    public string id {get; set;}    public string name {get; set;}}<select class="custom-select" @bind="@object.apple"><option value="@object.apple">@object.apple.name</option>     ...</select>

I want to bind the select to an object, but only want to display some attribute of that object. This will give me the error:

System.InvalidOperationException: The type 'other_object' does not have an associated TypeConverter that supports conversion from a string. Apply 'TypeConverterAttribute' to the type to register a converter.

Is this possible to do? I'm not really sure how the type converter thing works.


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>