Advertisement
Guest User

Untitled

a guest
Mar 1st, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. public class UserProfileViewModel
  2. {
  3. public ApplicationUser userProfile { get; set; }
  4. public AddressViewModel userAddress { get; set; }
  5. }
  6.  
  7. public class AddressViewModel
  8. {
  9. public int ID { get; set; }
  10. ......
  11. public virtual List<GeoData> GeoDataList { get; set; }
  12. }
  13.  
  14. @model MySite.ViewModels.UserProfileViewModel
  15. ...
  16. @foreach (var item in Model.userAddress.GeoDataList)
  17. {
  18. <dd>
  19. @Html.DisplayFor(modelitem => item.PlaceName)
  20. </dd>
  21. }
  22.  
  23. @foreach (var item in Model.userAddress.GeoDataList)
  24. {
  25. <dd>
  26. @Html.DisplayFor(modelitem => (item.PlaceName + ", " + item.PostalCode + ", " + item.Latitude + ", " + item.Longitude))
  27. </dd>
  28. }
  29.  
  30. Templates can be used only with field access, property access, single-dimension array index, or single-parameter custom indexer expressions.
  31.  
  32. @foreach (var item in Model.userAddress.GeoDataList)
  33. {
  34. <dd>
  35. @Html.Display(item.PlaceName + ", " + item.PostalCode + ", " + item.Latitude + ", " + item.Longitude)
  36. </dd>
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement