MVC 4 Html.EditorFor is not working
asp.net-mvc-4
Solution
The second argument of the EditorFor helper doesn't do at all what you think it does. You seem to be attempting to provide it with a value and expect that this value will be shown in the generated textbox but that's not what this argument is for. This argument is called `additionalViewData` and as its name suggests allows you to pass custom additional view data to the editor template. But if you don't have a custom editor template that does something useful with this view data you cannot expect that much will happen.
I would recommend you reading the `following blog post` to better familiarize with the templates in ASP.NET MVC.
But to actually answer your question, you seem to be attempting to write a custom template that will render each of the properties of your object. You could write a custom editor template that will do this job. Brad Wilson illustrated this concept in the `following post` (take a look at the section Shallow Dive vs. Deep Dive towards the end of the article).
Problem
I want to display an Edit page using reflection, loop through all properties of my object and create the right edit control for each property. My view looks good enough to do this, I run the app and the controls for editing are shown as expected, BUT, say I want to edit object with id=4, normally I should have on the page this object one time with edit controls for each property, problem is that I get the same object more than once, the object is repeated several times on the page with the same controls and properties. Am I missing something here? ``` ... @using (Html.BeginForm()) { @Html.ValidationSummary(true) <fieldset> <legend>Test</legend> <table> @{ var props = Model.GetType().GetProperties();} @foreach (var prop in props) { <tr> <td><div>@Html.EditorFor(model => Model, prop.GetValue(Model, null))</div></td> </tr> } </table> </fieldset> } ... ```