bind to object

Hi.


When can we expect that se can use @bind-value to a Guid or object for autocomplete, dropdown and multiselect?


Since now the controls are useless.


Best regards!


2 Replies

MM Mohanraj Mathaiyan Syncfusion Team March 29, 2022 04:39 AM UTC

Hi Ziga,


Greetings from Syncfusion support.


You can bind Guid type values using @bind-value property as mentioned in the below code snippet.



[counter.razor]

@using Syncfusion.Blazor.DropDowns

 

<SfAutoComplete TValue="Guid?" Placeholder="e.g. Australia" TItem="Countries" @bind-Value="@DropVal" DataSource="@Country">

<AutoCompleteFieldSettings Value="ID" Text="ID"></AutoCompleteFieldSettings>

</SfAutoComplete>

<br />

<br />

<SfDropDownList TValue="Guid?" Placeholder="e.g. Australia" TItem="Countries" @bind-Value="@DropVal" DataSource="@Country">

<DropDownListFieldSettings Value="ID" Text="ID"></DropDownListFieldSettings>

</SfDropDownList>

<br>

<br />

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

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

</SfMultiSelect>

 


You can bind object type values using @bind-value property as mentioned in the below code snippet.


[Index.razor]

 

@using Syncfusion.Blazor.DropDowns

<SfDropDownList TValue="Countries1" TItem="Countries1" @bind-Value="@ddlValue2" Placeholder="Select a country" DataSource="@Country1">

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

</SfDropDownList>

<br>

<SfMultiSelect TValue="List<Countries>" TItem="Countries" @bind-Value="@MultiValue" Placeholder="Select a country" DataSource="@Country">

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

</SfMultiSelect>

 


Currently we are facing issue when binding complex value to Auto complete component, the fix for this issue will be available in the patch release expected on April 12th 2022. You can track the status of the issue through the following feedback link

https://www.syncfusion.com/feedback/33738/unhandled-exception-throws-while-using-object-value-to-bind-vlaue-property


Also we have attached working sample for your reference. Let us know if you have any concerns in the above the solution.


Thanks,

Mohanraj M


Attachment: WebApplication2_8690ed07.zip


SP Sureshkumar P Syncfusion Team May 5, 2022 11:32 AM UTC

We are glad to announce that the fix for the reported issue has been implemented in the weekly patch release 20.1.52. We request you to update the NuGet to the latest version to get rid of this issue.


Find the release notes here: https://blazor.syncfusion.com/documentation/release-notes/20.1.51?type=all#autocomplete


Loader.
Up arrow icon