Combobox DropDown not showing after Item Selected

I'm encountering an issue with the ComboBox in my application. After selecting an item from the ComboBox, the dropdown button stops responding. To make the Dropdown button functional again, I have to press the 'Clear' button. Is this behavior expected, or is there a way to resolve this issue? Your guidance and assistance in troubleshooting this behavior would be greatly appreciated


<SfComboBox id="contato" TItem="Contato" TValue="Contato" @bind-Value="Contato" DataSource="@ClienteOrcamento.Contatos" IgnoreCase="true" IgnoreAccent="true">

<ComboBoxFieldSettings Value="nome"></ComboBoxFieldSettings>

</SfComboBox>


    public class Contato

    {

        [Key]

        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]

        public int Id { get; set; }


        [MaxLength(255)]

        [Required]

        public string nome { get; set; }


        [MaxLength(25)]

        public string? telefone { get; set; }


        [MaxLength(100)]

        public string? email { get; set; }


        public int ClienteId { get; set; }


        public virtual Cliente Cliente { get; set; }

    }


1 Reply

PK Priyanka Karthikeyan Syncfusion Team October 31, 2023 01:14 PM UTC

Hi Cezar,

Please ensure that you set the bind-Value property correctly on your end. The bind-Value attribute supports string, int, Enum, and bool types. In your code, it appears that you are binding a class to the bind-Value attribute. Kindly refer to the code snippet and sample provided below for your reference.

<SfComboBox id="contato" TItem="Contato" TValue="string" @bind-Value="SelectedValue" DataSource="@Contatos" IgnoreCase="true" IgnoreAccent="true">

<ComboBoxFieldSettings Value="nome"></ComboBoxFieldSettings>

</SfComboBox>

@code{

    public string SelectedValue = "AU";

    public class Contato

    {

        public int Id { get; set; }

        public string nome { get; set; }

        public string? telefone { get; set; }

        public string? email { get; set; }

        public int ClienteId { get; set; }

        public virtual string Cliente { get; set; }

    }

    List<Contato> Contatos = new List<Contato>

    {

        new Contato() {     Id = 1, nome = "AU", telefone="AU", email="[email protected]", ClienteId=2, Cliente="AU" },

        new Contato() { Id = 2, nome = "BU", telefone="BU", email="[email protected]", ClienteId=2, Cliente="BU" },

    };

    }

Samplehttps://blazorplayground.syncfusion.com/LtBAWNAszQfTBntV

For more information about the data binding, Please refer the below UG documentation

https://blazor.syncfusion.com/documentation/combobox/data-binding
 

If you are still experiencing the issue, please modify the shared sample according to your scenario, providing steps to replicate the issue, and include a video illustrating the problem if possible for better assistance.

Regards,

Priyanka K


Loader.
Up arrow icon