DEV Community

Discussion on: Add items dynamically in list in .net core

Collapse
 
stevcooo profile image
Stevan Kostoski

I can't reproduce that, can you check out my repository
github.com/stevcooo/AddItemsDynami...

Collapse
 
jstafford5380 profile image
jstafford5380

Yes will do. I've been working on this exact scenario for a while now and I'm getting really frustrated with the inconsistency in how the model binder works... I think I've gotten to the point where I can consistently add more items, but I'm noticing that the post back of new items appears in the payload but not in the page model. But the page model has the other data and the payload does not.

Collapse
 
jstafford5380 profile image
jstafford5380

Ok I was able to get rid of it. I was using razor pages instead of controllers and I had a javascript bug. So I can add all day long. Can you expand this to add a delete? I'm seeing an issue where the form data doesn't seem to be updating. To reproduce, add two items an keep track of their IDs. Delete the first item and everything seems fine, now add one back, suddenly the first ID is back