DataGridMultipleSelection - problem with @bind-Value=@multipleValues

Hi there
I had an issue where i an unable to bind the checkboxlist to the data.

error > cannot convert from 'object' to Models.User
i have declared the object > @bind-Value=@multipleValues*

here is part of the code ..., any ideas on how to solve this? thank-you in advance

    <RadzenGrid AllowFiltering="true" FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive" FilterMode="FilterMode.Advanced" AllowPaging="true" PageSize="4"
                AllowSorting="true" Data="@UList" TItem="User" ColumnWidth="200px" SelectionMode="DataGridSelectionMode.Multiple" @bind-Value=@multipleValues>

       
        <Columns>
            
            <RadzenGridColumn TItem="User" Width="40px" Sortable="false" Filterable="false">
                <HeaderTemplate>
                    <RadzenCheckBox TriState="false" TValue="bool" Value="@(UList.Any(i => multipleValues != null && (multipleValues as IEnumerable<User>).Contains(i)))"
                                    Change="@(args => multipleValues = args ? UList : null)" />
                </HeaderTemplate>
                <Template Context="data">
                    <RadzenCheckBox TriState="false" Value="@(multipleValues != null && (multipleValues as IEnumerable<User>).Contains(data))" />
                </Template>
            </RadzenGridColumn>

            <RadzenGridColumn TItem="User" Property="UserName" Title="User Name">
                <EditTemplate Context="user">
                    <RadzenTextBox @bind-Value="user.UserName" Style="width: 100%; display: block" Name="User Name"/>
                    <RadzenRequiredValidator Text="Group name is required" Component="UserOverviewPage" Popup="true"/>
                </EditTemplate>
            </RadzenGridColumn>

You can check our demo for reference

Thank you for your prompt reply , however i am unable to see the cause, i seem to have all the necessary fields in place

Hi, I'm struggling with this as well. I'm trying to follow the example, but I can't seem to set the initial variable that value links to correctly. Here's a screenshot. My value list is called SelectedNotes. I've tried setting to an empty list, to just an object, to a dynamic, nothing seems to work when I want to get the list from the grid.

HI @kgordon,

You can use object since the value can be single item or IEnumerable<TItem>. Unfortunately dynamic will not work for Blazor bindings. Also at the moment the only way to tell Radzen to two-way bind DataGrid Value property is to use attribute:




Use the latest version of radzen from nuget and this problem will disappear.

Excellent!! solved with the new update