DataGrid with multiple elements for one column

I have an object called Employee with a Roles property which is a List of type Role. Role has only one property: Name. I would like to select roles of an employee with a multiple select dropdown component. I got that working the following way:

    <RadzenDataGridColumn TItem="Employee" Property="Employee.Roles" Title="Roles">
        <EditTemplate Context="employee">
            <RadzenDropDown @bind-Value="@employee.Roles" Data=@roles TextProperty="Name" Multiple=true AllowClear=true Placeholder="Roles">                 </RadzenDropDown>
        </EditTemplate>
    </RadzenDataGridColumn>

Looks like this:
RolesDropDown

The problem is this part: Property="Employee.Roles"
I cant show the selected role names combined in the grid

Looks like this:
RolesGrid

Anyone got a solution for this?

Thanks

Hi @Simon_B,

Check my reply in this thread: Show Roles in users grid is always empty - #6 by korchev

You need to set the Template as well. Probably

<RadzenDataGridColumn TItem="Employee" Property="Employee.Roles" Title="Roles">
   <EditTemplate Context="employee">
       <RadzenDropDown @bind-Value="@employee.Roles" Data=@roles TextProperty="Name" Multiple=true AllowClear=true Placeholder="Roles"></RadzenDropDown>
   </EditTemplate>
   <Template Context="employee">
      @string.Join(", ", employee.Roles.Select(r => r.Name))
   </Template>
</RadzenDataGridColumn>
1 Like

Hi @korchev,
thanks for your reply. I will check that out soon and let you know if that solved my problem :slight_smile:

Hi @korchev,
inally able to try it out. Works perfectly for me. Thank you very much :slight_smile: