Updating SfMultiSelect's value not working

Hi,

When we update the original bind-Value (we set a value and this displays) the value is not updating

TValue="int[]" @bind-Value="Reservation.TableIds"

Any ideas?


Alex



3 Replies

UD UdhayaKumar Duraisamy Syncfusion Team May 11, 2023 12:21 PM UTC

Hello Alex,


We have validated the reported query on our end, but unfortunately, we were unable to reproduce the reported issue as per your scenario. We have also shared a sample and video illustration for your reference. In order to assist us in identifying the problem and provide a better solution, we kindly request that you provide additional details about the issue, as mentioned below:


  1. A simple, runnable sample that illustrates the issue you are experiencing (or modify the shared sample as per your scenario).
  2. Issue replication steps.
  3. A video illustration of the issue.


<div style="margin:130px auto;width:300px">

    @if (MultiVal != null)

    {

        @foreach (var SelectedValue in MultiVal)

        {

            <p>MultiSelect value is:<strong>@SelectedValue</strong></p>

        }

    }

    <SfMultiSelect TItem="Country" TValue="int[]" Placeholder="e.g. Australia" @bind-Value="@MultiVal" DataSource="@Countries">

        <MultiSelectFieldSettings Text="Name" Value="Code"></MultiSelectFieldSettings>

    </SfMultiSelect>

    <button @onclick="Update">Bind Value to MultiSelect</button>

</div>

 

@code {

 

    public int[] MultiVal { get; set; } = new int[] { 1 };

 

    public class Country

    {

        public string Name { get; set; }

 

        public int Code { get; set; }

    }

 

    public void Update()

    {

        MultiVal = new int[] { 1, 2, 3 };

    }

    List<Country> Countries = new List<Country>

    {

        new Country() { Name = "Australia", Code = 1 },

        new Country() { Name = "Bermuda", Code = 2 },

        new Country() { Name = "Canada", Code = 3 },

        new Country() { Name = "Cameroon", Code = 4 },

    };

}




Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/BlazorServerApp490905865


Regards,

Udhaya Kumar D



AL Alex May 15, 2023 06:53 PM UTC

Thanks for the response.  


As you can see from our code, we are doing very similar but the not setting the value of the multiselect but they the datasource has a








UD UdhayaKumar Duraisamy Syncfusion Team May 16, 2023 05:15 AM UTC

Hi Alex,


As mentioned earlier, we kindly request that you provide additional details about the issue, as stated below:


  1. A description of the specific scenario in which you are experiencing the issue.
  2. A runnable sample that demonstrates the issue, or a modified version of the previously shared sample that reflects your specific scenario.
  3. Detailed replication steps that we can follow to reproduce the issue.
  4. A video illustration of the issue.


This information will be very helpful in helping us resolve your issue as quickly and efficiently as possible.



Loader.
Up arrow icon