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:

SSL Error - The connection for this site is not secure

 After cloning a git repo of dot net framework website and trying to run it all I could see was this error Turns out the fix was to simply e...