As a beginner with ASP .net MVC i m trying to update database using Entity Framework but the id is always null what it make the modelstate always non Valide this is Code of the Controller
2 Answers
Your Id is equal to null because the model binder doesn't find a value from your posted data.
To solve this you must add the Id as a hidden field into your view. In your Edit.cshtml just add the following line :
@Html.HiddenFor(model => model.Id)
1 Comment
mejdi Radhouani
It is always null :/
