Hello, When I try to save an entity I get an error:
Object reference not set to an instance of an object
I am able to create a new entity, the code is almost the same.
When I try to save the entity I am able to trace a bit of the code My Controller code looks like this:
_entities.Kandidaats.Attach(kandidaatBewerken,true);
_entities.SubmitChanges();
return RedirectToAction("Index");
When I trace the code, I see that my kandidaatBewerken holds the right data, on the first line, after that the trace goes back to my view code and gives the error on the second line:
<% using (Html.BeginForm()) {%>
<%= Html.TextBox("KandidaatId", Model.KandidaatId)%>
When I trace it, it says that my Model is empty, while just a handling before this one, it is filled.
Why do I get this error and how can I move forward?