I'm using MudBlazor, specifically MudSelect
. I want to display the Name
property, but save the Id
property in the Value. The following is working.
<MudSelect T="int" Label="Assigned Group" Variant="Variant.Outlined" Required="true" RequiredError="An Assigned Group is required." @bind-Value="newTask.GroupId" AdornmentIcon="@Icons.Filled.Group">
@foreach (var group in Groups)
{
<MudSelectItem Value="@group.Id">@group.Name</MudSelectItem>
}
</MudSelect>
But, as the number of options starts growing it makes sense to add a search field along the Select List
. I don't know how to use that in MudSelect
. And while using MudAutocomplete
, which gives me a search function, I don't know how to associate the Id
to the selected Name
. And while, since my Name
, is unique I can do some processing on the submit
to get the Id
, I want to prevent the extra processing
ToStringFunc
parameter ofMudAutocomplete
. Using that you can achieve everything you need. – Jemena