C
C#2y ago
linqisnice

❔ Razor page with multiple forms causes modelstate to be invalid because some properties are null

And if I set these properties to nullable, it can't even be overriden with fluent validation .NotNull(). So, basically, I have createsong and an updateplaylist forms on my page that submit to two different post actions in the cshtml... but when i check for modelstate.isvalid in for example the createsong action it will always be invalid because the properties songtitle and songartist are both null and vice versa when I check the model state on the other form submission. How do I solve this with best practice? or am I missing something?
1 Reply
Accord
Accord2y ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.