DataGrid with RadzenDropDown in EditTemplate doesn't change property value

I have a DataGrid binded on this class:

public class JobPositionDTO : EntityChangesDTO
    {
        public EntityBaseDTO ProductType { get; set; }
        public int ItemsCount { get; set; }
        public int EquipmentsCount { get; set; }
        public string Var1 {get; set; }
    }

with EntityBaseDTO class defined as follow:

    public class EntityBaseDTO
    {
        public string Id { get; set; }
        public string Code { get; set; }
        public string Name { get; set; }
    }

I would like to show in the edit mode a drop down list with a list of all ProductType values but when I confirm the edit the value is always the old one.

Here my markup:

<RadzenDataGrid @ref="_dataGrid1" AllowMultiColumnSorting="true" AllowFiltering="true" AllowPaging="true" AllowSorting="true" AllowColumnResize="true"
                FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive" FilterMode="FilterMode.Simple"                 PageSize="@_pageSize" Data="@_data" LoadData="@LoadData" TItem="JobPositionDTO"
                IsLoading="@_isLoading"
                Count="@_count">
    <Columns>
    <RadzenDataGridColumn Width="Auto" TItem="JobPositionDTO" Property="ProductType.Code" Title="@Loc["ProductType"]" FilterOperator="FilterOperator.Equals"
                              Sortable="true" Filterable="true">
            <EditTemplate Context="data">
                <RadzenDropDown @bind-Value="@data.Element.ProductType.Id" Data="@productTypesL" TextProperty="Code" ValueProperty="Id" Style="width:100%" />
            </EditTemplate>
        </RadzenDataGridColumn>

<RadzenDataGridColumn TItem="JobPositionDTO" Filterable="false" Sortable="false" TextAlign="TextAlign.Center" Width="100px">
            <Template Context="data">
                <RadzenButton Icon="edit" Size="ButtonSize.Small" Click="@(args => EditRow(data))" @onclick:stopPropagation="true" />
            </Template>
            <EditTemplate Context="data">
                <RadzenButton Icon="save" Size="ButtonSize.Small" Click="@((args) => SaveRow(data))" />
                <RadzenButton Icon="cancel" Size="ButtonSize.Small" ButtonStyle="ButtonStyle.Secondary" Click="@((args) => CancelEdit(data))" />
            </EditTemplate>
        </RadzenDataGridColumn>
    </Columns>
</RadzenDataGrid>

@code
{
        private async Task SaveRow(JobPositionDTO jobPosition)
        {
            // jobPosition HAS ALWAYS OLD ProductType VALUE
        }

 private void CancelEdit(JobPositionDTO jobPosition)
        {
            _dataGrid1.CancelEditRow(jobPosition);
        }

   private void EditRow(JobPositionDTO jobPosition)
        {
            _dataGrid1.EditRow(jobPosition);
        }
}

I see a discrepancy. TItem of the DataGrid is set to JobPositionDTO while TItem of the column is set to IViewModel< JobPositionDTO>. This is not supported - both should be set to the same type.

Sorry, a copy and paste error.
It's always TItem="JobPositionDTO"

Problem is still valid.
Thank you

JobPositionDTO does not have an Element property considering the provided code.

Sorry, fixed code

public class DropDownItem
    {
        public string Text { get; set; }
        public string Value { get; set; }
    }

public class JobPositionDTO
    {
        public EntityBaseDTO ProductType { get; set; }
        public int ItemsCount { get; set; }
        public int EquipmentsCount { get; set; }
        public string Id {get; set; }
    }

    public class EntityBaseDTO
    {
        public string Id { get; set; }
        public string Code { get; set; }
        public string Name { get; set; }
    }

<RadzenDataGrid @ref="_dataGrid1" AllowMultiColumnSorting="true" AllowFiltering="true" AllowPaging="true" AllowSorting="true" AllowColumnResize="true"
                FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive" FilterMode="FilterMode.Simple"
                 PageSize="@_pageSize" Data="@_data" LoadData="@LoadData" TItem="JobPositionDTO"
                IsLoading="@_isLoading"
                Count="@_count">
    <Columns>
    <RadzenDataGridColumn Width="Auto" TItem="JobPositionDTO" Property="ProductType.Id" Title="@Loc["ProductType"]">
            <EditTemplate Context="data">
                <RadzenDropDown @bind-Value="@data.ProductType.Id" Data="@productTypes" TextProperty="Text" ValueProperty="Value" Style="width:100%" />
            </EditTemplate>
        </RadzenDataGridColumn>

<RadzenDataGridColumn TItem="JobPositionDTO" Filterable="false" Sortable="false" TextAlign="TextAlign.Center" Width="100px">
            <Template Context="data">
                <RadzenButton Icon="edit" Size="ButtonSize.Small" Click="@(args => EditRow(data))" @onclick:stopPropagation="true" />
            </Template>
            <EditTemplate Context="data">
                <RadzenButton Icon="save" Size="ButtonSize.Small" Click="@((args) => SaveRow(data))" />
                <RadzenButton Icon="cancel" Size="ButtonSize.Small" ButtonStyle="ButtonStyle.Secondary" Click="@((args) => CancelEdit(data))" />
            </EditTemplate>
        </RadzenDataGridColumn>
    </Columns>
</RadzenDataGrid>

@code
{

        private RadzenDataGrid<JobPositionDTO> _dataGrid1;
        private ICollection<JobPositionDTO> _data;
        private int _count;
        private bool _isLoading;
        private int _pageSize = 50;
        private string productType;
        private List<DropDownItem> productTypes;

private async Task LoadData(LoadDataArgs args)
        {
_data = new List<JobPositionDTO>{new JobPositionDTO {
        ProductType = new EntityBaseDTO
        {
              Id= "1",
              Code="Code1",
              Name = "Name1"
        },
        ItemsCount = 5,
        EquipmentsCount = 4,
        Id = "Id1"
       },
       new JobPositionDTO {
        ProductType = new EntityBaseDTO
        {
              Id= "2",
              Code="Code2",
              Name = "Name2"
        },
        ItemsCount = 23,
        EquipmentsCount = 14,
        Id = "Id2"
       },
});

// It's a collection created on ProductType all values: DropDownItem Value match with EntityBaseDTO Id 
productTypes = new List<DropDownItem>{
        new DropDownItem
        {
              Value= "1",
              Text="Name1 - Code1"
        },
         new DropDownItem
        {
              Value= "2",
              Text="Name2 - Code2"
        },
       
         new DropDownItem
        {
              Value= "3",
              Text="Name3 - Code3"
        },
});
}

private async Task SaveRow(JobPositionDTO jobPosition)
        {
            // jobPosition HAS ALWAYS OLD ProductType VALUE
        }

 private void CancelEdit(JobPositionDTO jobPosition)
        {
            _dataGrid1.CancelEditRow(jobPosition);
        }

   private void EditRow(JobPositionDTO jobPosition)
        {
            _dataGrid1.EditRow(jobPosition);
        }


}

Try setting ProductType itself.

<RadzenDropDown @bind-Value="@data.ProductType"
    Data="@productTypes" TextProperty="Text" Style="width:100%" />

Exception: cannot convert from DropDownItem to EntityBaseDTO.

It works if I do:
<RadzenDropDown @bind-Value="@data.ProductType" Data='@_productTypesL' TextProperty="Code" Style="width:100%"></RadzenDropDown>

where _productTypesL is a List<EntityBaseDTO>, but in this way I can't format my text value to "Code - Name"

Solved in this way:

                <RadzenDropDown @bind-Value="@data.Element.ProductType" Data='@_productTypesL' TextProperty="Code" Style="width:100%">
                    <Template Context="item">
                        @($"{((EntityBaseDTO)item).Code} - {((EntityBaseDTO)item).Name}")
                    </Template>
                </RadzenDropDown>

Thank you very much