Skip to content

Infragistics Community Forum / Web / Ignite UI for Blazor / Binding to a Nested Object in Blazor DataGrid

Binding to a Nested Object in Blazor DataGrid

New Discussion
Matthew Cuda
Matthew Cuda asked on Dec 16, 2021 3:31 PM

How would I bind a datagrid column to a nested object?

For example:

<TextColumn IsEditable = “false” Field=”AssignedSeverity.Name” HeaderText=”Severity” Width=”@(“*>120″)” />

//FRAGMENT OF CLASS BELOW

public class Request
{
private int _id = -1;
private string _problem = string.Empty;
private string _solution = string.Empty;
private Severity _assignedSeverity = new Severity();

public int Id { get => _id; set => _id = value; }

public string Problem { get => _problem; set => _problem = value; }
public string Solution { get => _solution; set => _solution = value; }
public Severity AssignedSeverity { get => _assignedSeverity; set => _assignedSeverity = value; }

Sign In to post a reply

Replies

  • 0
    Andrew Goldenbaum
    Andrew Goldenbaum answered on Dec 16, 2021 3:31 PM

    Hello Matthew,

    At the time of writing this, the Ignite UI for Blazor DataGrid does not support binding the Field property of its columns to complex/nested objects. The best thing I can recommend at the moment is that you flatten out your data as it pertains to the grid.

    For example, I see you are trying to bind to AssignedSeverity.Name. I am assuming this is probably a string property, and so you can define a new string property on your Request class that returns AssignedSeverity.Name and then point your TextColumn’s Field at that property.

    Please let me know if you have any other questions or concerns on this matter.

    • 0
      Matt Wills
      Matt Wills answered on Jun 10, 2022 2:17 PM

      Or you could use CellTemplate to access the nested property

      <Column T="Model" Field="HireDate" Title="Hired">
                  <CellTemplate>
                      @context.Item.HireDate.ToString("d")
                  </CellTemplate>
              </Column>
  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Matthew Cuda
Favorites
0
Replies
1
Created On
Dec 16, 2021
Last Post
3 years, 8 months ago

Suggested Discussions

Created by

Created on

Dec 16, 2021 3:31 PM

Last activity on

Feb 11, 2026 9:52 AM