JavaScript UI Libraries & Blazor Components Suite – Smart UI Forums DropDownList Add items to DropdownList dynamically (Blazor)

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #102532

    I want to add items to the dropdown list after the inital load (see the simplified example below)

    Though the data source has changed, the dropdown list is not showing the new item(s)

    How can you force to update the displayed items?

    <DropDownList @bind-SelectedValues=”@DropDownListBoxValue” DataSource=”@DataSource”>
    <br />
    <h3>DropDownList selected value: @DropDownListBoxValue[0] </h3>
    <br />
    <button type=”button” class=”btn btn-primary” @onclick=”AddItem”>Add item</button>

    @code {

    public List<string> DataSource = new List<string>()
    “Item 1”,
    “Item 2”,
    “Item 3”,
    “Item 4”

    public string[] DropDownListBoxValue = new string[] { “Item 3″ };

    private void AddItem()
    int nNewItem = DataSource.Count + 1;

    DataSource.Add($”Item {nNewItem}”);

    // Are further steps needed to refresh the dropdown list?


    Yavor Dashev

    Hi TurricanDE,

    I have tested the Smart.Blazor.DropDownList and its functionalities regarding adding items or updating and there appears to be some issue with them.

    That is why I have added a work item for this use case and we will work to fix as soon as we are able to.

    I would like to thank you for reporting this use case as it helps us improve our components constantly.

    Please, do not hesitate to contact us if you have any additional questions.

    Best regards,
    Yavor Dashev
    Smart UI Team

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.