I have a list of key / value pairs. basically its List, where ViewModel is a custom form class
public class ViewModel { public String Key { get; set; } public String Value { get; set; } }
In the view, I will need to display Label and Textbox for Key and Value respectively. I am trying to use Html.DisplayFor (), however it comes with a model and displays only the properties of the model, not the list.
I would like to get something in the format
<% foreach (var item in Model) { %> <tr> <td> <%:Html.Display("item")%> </td> <td> <%:Html.Display("item.Value")%> </td> </tr> <% } %>
source share