Possible bug with creating detail record on Master/Detail grid page

I may have found a bug in the latest version using an Angular client:

  • create an SQL Server database with simple Project and ProjectTask master and detail tables (both having an integer identity PK called Id and ProjectTask having a ProjectId FK)
  • populate the two tables with some sample data directly in the database
  • create a brand new RadZen app with an SQL Server datasource
  • add a new Master/Detail grid page
  • allow Add on both Grid0 and Grid1 (default names for the two grids)
  • run the application

You can add and edit Projects, but you can only edit ProjectTasks. When you try to add a new Project task you simply get a red "Unable to create new ProjectTask!" popup error.

There are no console errors, but the network error indicates a 400 Bad Request error. When you put a breakpoint in the backend controller it appears that the submitted request is null.

Digging some more... this is what an Edit request looks like:
{"Id":1,"ProjectId":1,"SortOrder":1,"Title":"My First Task","Description":"My First Description","IsCompleted":false}

But this is what a Create request looks like:
{"SortOrder":2,"Title":"New Add","Description":"Adding this new project task","IsCompleted":true,"ProjectId":"1"}

It appears to me that RadZen incorrectly passes the ProjectId FK as a string during the create request whereas it is correctly passes as an integer during the edit request.

Thanks for your help

Hi @Xander.

I've tried to reproduce this using our Sample database Orders -> OrderDetails (both tables have integer identity primary keys and OrderDetails.OrderId is integer foreign to Orders.Id) however everything worked as expected.

If you hold Radzen license you can send us your app and database schema to info@radzen.com to check what's going on.

Best Regards,
Vladimir

I think I've determined what the problem is - it works fine when OrderID is an INT but not when it is a BIGINT. When you change it to a BIGINT you should be able to replicate my issue.

Regards