creating html stuff with asp.net mvc i really easy… thanks to the htmlhelper class… for example to create a input box:
@Html.EditorFor(model => model.Name)
this line of code renders the <input>-tag, with set value, name… based on the models attribute… so if its a string it renders a textbox… it its a bool, it renders a checkbox… this checkbox is rendered a little bit special, because there is always a hidden filed set false… i think this is needed to return always a value for the checkbox, even if its not checked… sounds great, but the result must be checked differently:
active = (collection[<checkboxName>].Contains(“true”) ? true : false);
Its a really cool helper… but has a really big problem… Html.EditorFor is currently not able to set a class… there for desinging the input fields is hard… for a textbox it renders class=”text-box single-line”… so simply add these to your css file… works good, but with a company wide stylesheet its kinda crap…