One To Many

I have created a simple blazor web assembly app with a one to many relationship Customers/orders (jobs). Everything works except posting a detail record. It posts the record, but the customer id is empty in the detail record. i can use ssms and fix the issue in the record, i can display and edit the detail record with no problem. I can see in the debugger when i add a record it saves the value to the table, but when submit form happens the id is null.
[Parameter]
public int? CustomerID { get; set; }
public override async Task SetParametersAsync(ParameterView parameters)
{
tblJob = new VersaconWebAssembly.Server.Models.VersaconII.TblJob();

        hasCustomerIDValue = parameters.TryGetValue<int?>("CustomerID", out var hasCustomerIDResult);

        if (hasCustomerIDValue)
        {
            tblJob.CustomerID = hasCustomerIDResult;
        }
        await base.SetParametersAsync(parameters);
    }

Hi @Mark_Harned,

Can you post more info which template you’ve used to create the pages - Master/Detail Hierarchy or Master/Detail DataGrid?

UPDATE: I was able to reproduce the problem. The issue is in our template and will be fixed in our next update, in the meantime you can delete the new instance creation in OnInitializedAsync method:


`

Wow that was quick, thank you very much.

One more while you are at it :grinning:
When you delete detail record the data grid does not update. The record is deleted, just no refresh

Unfortunately I was not able to reproduce this with both templates.

Any additional info? Are you using server Blazor or WASM?

Wasm
two data grids , one to many

Thanks! Reproduced and fixed - here is what you can add in your code to fix it:

Where order in this case is the name of the variable assigned in master DataGrid RowSelect.

All works, thank you