310697 - Now, you can provide collection of object type to Value property.

Hi 

I have a multiselect that should bind to and save complex object like the example on the attached screen shot. 

All events are triggered and worked fine. but the value never shows up;

So for ex: on database, when a school is selected, it save the newly selected school data to database, but the multiselect textbox it is always empty.


Below is my sample code:


                <SfMultiSelect TItem="School" TValue="IList<School>" AllowFiltering="true" CssClass="form-control p-1" ShowDropDownIcon="true">

                    <SfDataManager Adaptor="Adaptors.CustomAdaptor">

                        <SchoolAdaptor T="User"></SchoolAdaptor>

                    </SfDataManager>

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

                    <MultiSelectEvents TItem="School" TValue="IList<School>" OnValueSelect="OnUserSchoolSelected"

                        ValueRemoved="OnUserSchoolRemoved" Cleared="OnUserSchoolsCleared"></MultiSelectEvents>

                </SfMultiSelect>


Thanks beforehand.


Best reagrds,


Susanti


Attachment: Untitled_1013e87c.zip

1 Reply

DR Deepak Ramakrishnan Syncfusion Team December 6, 2021 06:09 PM UTC

Hi Sushanthi, 
 
Greetings from Syncfusion support. 
 
We have validated the reported issue and found that , we need to use @bind-Value attribute to bind the value to the component (Also you can refer the screenshot from your end which consist of respective property). Kindly refer the below code snippet and demo link for more details. 
 
<SfMultiSelect TValue="string[]" TItem="Countries" Placeholder="Select countries" DataSource="@country" @bind-Value="@CountryValue"> 
                    <MultiSelectFieldSettings Text="Name" Value="Code"></MultiSelectFieldSettings> 
                </SfMultiSelect> 
 
 
 
Kindly revert us if you still facing the issue after the above suggestion. 
 
Thanks, 
Deepak R. 
 


Loader.
Up arrow icon