Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 15th, 2012  |  syntax: None  |  size: 0.46 KB  |  hits: 10  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. MVC3 Best Practise with Collections in Razor
  2. <div>
  3.     <div>
  4.         @Html.LabelFor(x => x.Foo, "Foo")
  5.     </div>
  6.     <div >
  7.         @Html.TextBoxFor(x => x.Fishfood, new { style = "width: 200px" })
  8.     </div>
  9. </div>
  10.        
  11. <div>
  12.      @Html.EditorFor(x => x.FooBarItems)
  13. <div>
  14.        
  15. @foreach (var item in Model.Items)
  16. {
  17.     <div>
  18.         @Html.Label("Foo", item.Foo)
  19.     </div>
  20.     <div >
  21.         @Html.TextBox(item.Fishfood, new { style = "width: 200px" })
  22.     </div>
  23. }