Closed mikolajtr closed 7 years ago
So I suspect the POSTed model
is null, which is then being reflected over, causing the NRE.
Can you use Fiddler/Chrome Dev tools to see what is being POSTed?
The model
object is not null, only empty fields are. Besides normal form fields, I see in Fiddler __type
field with FormFactory.NonEncodingStringencoder
value(but it's normal, I understand).
do you need to set the ViewData values again? It looks like the NRE is being thrown in the view, not FormFactory code, and I don't see ViewData["Title"]
and ViewData["Action"]
being set.
Yes, now I see it. It was null from ViewData. It was strange for me that I didn't have this error when I use unassigned value from it.
When viewmodel is passed again to form as invalid (ModelState.IsValid == false), form in my Razor view throws System.NullReferenceException.
My viewmodel
My Razor view:
My POST controller method:
My GET controller method:
Stack trace: