Radzen Grid Column not showing value

Good Morning!

I'm new to Radzen so I apologize for the pretty basic question but I haven't been able to find anything from google searches. I'm trying to get a column to display a value from a different List from the main one being used as the data source. I followed the code listed here (Blazor DataGrid InLine Editing) but something seems to be missing.

Whenever the page loads, it just shows the name of my base model ('User' in this case) instead of the property, However it displays correctly when it Edit Mode. Thank you to anyone who can help out, please let me know if you need any more information!

Here is the code for the the Radzen (I removed the other columns since they are working properly)

<RadzenDataGrid  @ref="usersGrid" AllowColumnPicking="true"  Data="@users"  TItem="User" EditMode="DataGridEditMode.Single" RowUpdate="@OnUpdateRow">
<Columns>
  <RadzenDataGridColumn TItem="User" Property="Color.ColorName" Title="Favorite Color">
              <EditTemplate Context="user">
                  <RadzenDropDown @bind-Value="user.FavoriteColor" Data="@colors" TextProperty="ColorName" ValueProperty="ColorId" />
              </EditTemplate>
  </RadzenDataGridColumn>
  </Columns>
</RadzenDataGrid>

The User Model:

public class User
    {
        public int UserId { get; set; }
        public string Username { get; set; }
        public string UserEmail { get; set; }
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public int FavoriteColor { get; set; }
    }

The Colors Model:

public class Color
    {
        public int ColorId { get; set; }
        public string ColorName { get; set; } = "";
    }

Hi @MBoro,

Your User class does not have a Color property which is what you have set the Property to be. You may need to set the Template as well and display the color by using colors and FavoriteColor. Something like:

<Template Context="user">
    @colors.FirstOrDefault(c => c.ColorId == user.FavoriteColor)?.ColorName
</Template>
2 Likes