How can I bind a list of values to columns in a RadzenDataGrid?

I have a list of objects to show in a grid, where I have an ID value and a list of numbers to show in each row, but I have not been able to get the numeric values to display.

I have a list of columns that I am dynamically generating that correspond to the values in the data records. The columns are correctly generated, and the assigned captions display, but the data values do not show.

My model looks like this:

    public class AllocationModel
    {
        public string Account { get; set; }
        public List<AccountAllocation> Allocations { get; set; }
    }

AccountAllocation looks like this:

    public class AccountAllocation
    {
        public int OrdersSeq { get; set; }
        public string AcctCode { get; set; }
        public string IssuerCode { get; set; }
        public decimal Amount { get; set; }
    }

AllocationColumns are of type ColumnData, which looks like this:

    public class ColumnData
    {
        public string Property { get; set; }
        public string Caption { get; set; }
        public bool Visible { get; set; } = true;
    }

The following markup gives me an 'array out of bounds' error when accessing the data.Allocations[j].Amount property:

        <RadzenDataGrid AllowPaging="true" PageSize="10" Data="@AllocationInfo" TItem="AllocationModel" ColumnWidth="100px">
            <Columns>
                <RadzenDataGridColumn TItem="AllocationModel" Property="Account" Title="Acct">
                </RadzenDataGridColumn>
                @for(int j = 0; j < AllocationColumns.Count; j++)
                {
                    <RadzenDataGridColumn TItem="AllocationModel" Visible=@AllocationColumns[j].Visible Title=@AllocationColumns[j].Caption>
                        <Template Context="data"> 
                                @data.Allocations[j].Amount.ToString()                            
                        </Template>
                    </RadzenDataGridColumn>
                }
            </Columns>
        </RadzenDataGrid>

To troubleshoot, I replaced the Template section with the following:

                        <Template Context="data"> 
                                @j.ToString()
                        </Template>

The strange thing is that in this case, all of the cell values equal the number of columns in the AllocationsColumn list (i.e., if I have 15 columns of numbers, it shows '15' in all the cells). Thus, it looks like the loop is iterating through the list completely before evaluating any of the data.Allocations[j].Amount values

How can I show the values from the Allocations list correctly here?

That fixed it. Thanks.