Skip to content
This repository has been archived by the owner on Feb 25, 2019. It is now read-only.

Use model binding on the initial form #47

Open
williamdenton opened this issue Aug 15, 2016 · 0 comments
Open

Use model binding on the initial form #47

williamdenton opened this issue Aug 15, 2016 · 0 comments

Comments

@williamdenton
Copy link
Contributor

williamdenton commented Aug 15, 2016

when using MVC and Razor, the input element are usually create with Html.HiddenFor(m=> m.Lat) some can't be bound, like the unusual file input that is used, but the name element can still be set using @Html.NameFor(m=> m.image)

this doesn't add much in the way of functionality, but on a bigger app this helps with client side input field validation of required fields etc. This will need to @model namespace.to.model declaration at the top of index.cshtml

this makes it safer when refactoring code, as if the fields are ever renamed in the *.cs code you will get an error in the *.cshtml

Check out Pushpays VP Engineering talking about Connascence

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant