Datagrid, how to show different model list property

Hello i have a model like this

public class ABC
public string Id { get; set; }

    public List<EBC> EBCMODEL{ get; set; }

i really couldn't figured out how can i pass EBCMODEL and show its property values on columns. how can i do that. Thank you.

Can you provide more details? How is the ABC class used?

1 Like

Okey so, lets say ABC is FirmModel and the EBC is UserModel. I want to have 3 columns FirmName, UserName, UserDescription. So that kinda look like this.
I can write FirmName property to columns property section but i dont know how to pass UserModel's UserName property and UserDescription property. Thank you for caring.

You can usually use dot notation to access properties of nested objects:

<RadzenDataGridColumn Property="User.Name" />
1 Like

When i try to do that it looks like that in row System.Collections.Generic.List`1[project.utilities.Models.ResponseModels.UserModel]
May be i did not explain myself correclty. I have a class and that class has a property that is List and its an another class. Structure is like this

public class FirmModel
public string Id { get; set; }
public string FirmName{ get; set; }

    public List<UserModel> Users{ get; set; }


and my UserModel look like this

public class UserModel
public int Id { get; set; }
public string UserName{ get; set; }
public string UserDescription{ get; set; }

I am afraid I don't follow. Do you want RadzenDataGrid to display the Users property of that class? Then set its Data to model.Users.

RadzenDataGridColumn TItem="FirmModel" Property="FirmName" Title="Firm" />
<RadzenDataGridColumn TItem="UserModel" Property="UserName" Title="User Name"

Thats what i understand but thats not working :frowning: There is no problem with Firm column that shows the data true but the other columns is not working

This is my data => private List FirmModel FirmsUsers= new List FirmModel (); i deleted some keywords because it hides some words an doesn't show anything

RadzenDataGridColumn TItem="FirmModel" Property="FirmName" Title="Firm"
RadzenDataGridColumn TItem="UserModel" Property="UserName" Title="User Name"

RadzenDataGrid will not list items from a collection properties as columns. You may need to use the Template to do that e.g.

1 Like

Thank you that is worked. Now i will try to iterate this @context.Users[0].UserName for showing every user on different rows. If you have idea i can take. Thank you again for your patience. You are very kind.

I don't think this will work. RadzenDataGrid shows a collection of items and does not support such hierarchies.

1 Like