We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

When i change the DataSource behind a Multiselect which has SelectedValues, i got a Javascript Error

Thread ID:





151155 Feb 1,2020 06:12 PM UTC Feb 4,2020 11:48 AM UTC Blazor 3
Tags: MultiSelect Dropdown
Thomas Schinagl
Asked On February 1, 2020 06:13 PM UTC

My code looks like the following:

When the change event of the textbox triggers with value "foo", the new DataSource would be added and this javascript error is produced:

Please help

Berly Christopher [Syncfusion]
Replied On February 3, 2020 01:19 PM UTC

Hi Thomas, 
Greetings from Syncfusion support. 
While checking the provided code, we could not reproduce the reported issue at our end. So, we have prepared the sample and attached it below.  
Also, currently, we don’t have a list of string data source support for the MultiSelect component for a search action. So as of now, you can convert the string array to list type for your application requirement. We considered it as a feature and it will be included in the upcoming Volume 1 Main release which is expected to be rolled out on end of March 2020. 
Berly B.C 

Thomas Schinagl
Replied On February 3, 2020 04:07 PM UTC

Thanks for your Sample. I get the exact same error with your code:

Selecte an Item -> Type in "foo" in the Textbox

I dont use List<string> in the real application, but i want to create a simple sample

Sureshkumar P [Syncfusion]
Replied On February 4, 2020 11:48 AM UTC

Hi Thomas, 
We have validated your requirement and we suggest you make the component value Null before setting the data source dynamically to get rid of your facing issue. Please refer to the below code example. 
<EjsMultiSelect @ref="@multiObj" TValue="List<string>" @bind-Value="@MultiSelectID" DataSource="@DataList" 
    Mode="VisualMode.Box" Placeholder="Enter the value" AllowFiltering=true FilterType="FilterType.Contains" 
    <MultiSelectEvents TValue="List<string>" ValueChange="@(e => MultiSelectID = e.Value)"></MultiSelectEvents> 
public string TxtValue { 
         get { return _txtVal; } 
         set { 
            if (value == "foo") { 
                MultiSelectID = null; 
                DataList = new ObservableCollection<string> { "Four""Five" }; 
             _txtVal = value; 
Please find the modified sample from the below link. 
Sureshkumar P 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon