以下のクラスの例を見てください。顧客と 2 つの住所 (LIST から) をフォームに表示したいと考えています。MVC ベータ版のモデル バインダーはこれをサポートしていますか?それとも独自のカスタム バインダーを作成する必要がありますか?
public class Customer
{
public string FirstName { get; set; }
public string LastName { get; set; }
public List<Address> Addresses { get; set; }
public Customer()
{
Addresses = new List<Address>();
}
}
public class Address
{
public int Line1 { get; set; }
public int Line2 { get; set; }
public int City { get; set; }
public int State { get; set; }
public int Zip { get; set; }
}
フィールドをどのようにコーディングしますか? このような?
<!-- some HTML formatting -->
<%= Html.TextBox("customer.address.line1", ViewData.Customer.Address[0].Line1)%>
<!-- some more HTML formatting -->
<%= Html.TextBox("customer.address.line1", ViewData.Customer.Address[1].Line1)%>
<!-- end of HTML form formatting -->