views:

5

answers:

1

Hi, i've got this code

Model

public class PdfPage
{
  public IEnumerable<PdfPhoto> Photos { get; set; }
}

public class PdfPhoto
{
  public string path { get; set; }
}

View

<ul>
  <li>
    <%= Html.Hidden("ListPages[0].Photos[0].path", "/public/pdfMaker/4_e.jpg")%>
    <%= Html.Hidden("ListPages[0].Photos[1].path", "/public/pdfMaker/4_f.jpg")%>
    <%= Html.Hidden("ListPages[0].Photos[2].path", "/public/pdfMaker/13_p.jpg")%>
  </li>
  <li>
    <%= Html.Hidden("ListPages[1].Photos[0].path", "/public/pdfMaker/5_f.jpg")%>
    <%= Html.Hidden("ListPages[1].Photos[1].path", "/public/pdfMaker/7_f.jpg")%>
    <%= Html.Hidden("ListPages[1].Photos[2].path", "/public/pdfMaker/8_e.jpg")%>
    <%= Html.Hidden("ListPages[1].Photos[3].path", "/public/pdfMaker/8_f.jpg")%>
  </li>
  <li>
    <%= Html.Hidden("ListPages[2].Photos[0].path", "/public/pdfMaker/11_e.jpg")%>
  </li>
</ul>

Controller

public ActionResult Create(List<PaginaPdf> ListPages)
{
  string list = string.Empty;

  foreach (var page in ListPages)
    foreach(var photo in page.Photos)
      list += "photo: " + photo .path + "\r\n";

  return new ContentResult
  {
    Content = list
  };
}

but doesn't work.
Does anyone know how to bind a nested list in MVC 2?

A: 

Sorry, it works.
I miss a "s" in View. My mistake.

Sig. Tolleranza

related questions