Data not showing in SfMultiSelect in Edit Mode from Model Class

I have an "SfMultiSelect" control in my application.It works fine as per our requirement but When I bind data in sfMultiSelect (from model class) in EditMode then selected data not showing (data is unchecked in dropdown).Please check my below and advise where it is problem,


div class="content multiselect-checkbox">

                                            <SfMultiSelect TValue="string[]" TItem="FactorySetup" AllowFiltering="true" Mode="@VisualMode.CheckBox" @bind-Value="@selectedFactoryList"

                                                           DataSource="@LoadfactoryList" ShowSelectAll="true" EnableSelectionOrder="true" ShowDropDownIcon="true"

                                                           FilterBarPlaceholder="@GetResourceProvider.GetResourceValue(Resource, "lblFactoryList")" PopupHeight="350px">

                                                <MultiSelectFieldSettings Text="FactoryName" Value="FactoryID"></MultiSelectFieldSettings>

                                            </SfMultiSelect>

                                        </div>


  protected void OnEditClicked(CountrySetup args)

        {

 protected string[] selectedFactoryList { get; set; }

        protected string[] selectedInActiveList { get; set; }

            countrySetup = args;


            selectedFactoryList = countrySetup.FactoryList.Replace.Split(',');

            selectedInActiveList = countrySetup.InActiveList.Split(',');

            mode = CommonClassEnum.FormModes.Edit;


            newflag = 1;

            StateHasChanged();

        }


Note:-

1.countrySetup is an model class

2. the value of countrySetup.FactoryList = 1,2,4

3. the value of countrySetup.InActiveList = 1,2,5



3 Replies

KI KINS June 24, 2021 02:17 PM UTC

please help



KI KINS June 25, 2021 01:16 PM UTC

awaiting for reply..

Please help, it's my top most urgent



BC Berly Christopher Syncfusion Team June 25, 2021 04:09 PM UTC

Hi Hassan, 
  
Greetings from Syncfusion support. 
  
We have checked the shared code snippet. In the shared code, you have split up the values and assign it to the bind-value attribute. While using Replace.Split() then C# will throw the compilation error since Replace is act as method only. So, we have prepared the sample and attached it below. 
  
  
  
 
  
Can you please share the below details that will help us to check and proceed further from our end? 
  
1.       Have you rendered the MultiSelect component inside Grid component? If yes, please share the edit settings details. 
2.       Else, please share the EditMode details in your application. 
3.       Syncfusion product version. 
4.       Any video demonstration for this issue. 
  
Regards, 
Berly B.C 


Loader.
Up arrow icon