Friday, February 1, 2019

MVC edit form for an entity

Many times we need to use edit forms for complex entities. Though creating a form is rather easy with dot net MVC, there are some important bits which need to be remembered. The following link has a comprehensive example of implementing such a form.

https://blog.rsuter.com/asp-net-mvc-how-to-implement-an-edit-form-for-an-entity-with-a-sortable-child-collection/

Though this method seems very good, it was coded in older version of MVC and hence probably does not work with MVC core.

Another simpler way is to convert the model in JSON string and decode it in our action method. I prefer this method since it gives us complete control over the data passed from view to action method.

More information is available at https://stackoverflow.com/questions/21529092/asp-net-mvc-passing-models-by-actionlink

No comments:

c# httpclient The remote certificate is invalid according to the validation procedure: RemoteCertificateNameMismatch

 If we get this error while trying to get http reponse using HttpClient object, it could mean that certificate validation fails for the remo...