I have a client as :
public partial class Client
{
public Client()
{
ResponsablesClients = new HashSet<ResponsablesClient>();
}
[Key]
[StringLength(10)]
[ScaffoldColumn(false)]
public string CodeClient { get; set; }
[StringLength(50)]
[DisplayName("Raison sociale")]
[Required]
public string Name { get; set; }
public virtual ICollection<ResponsablesClient> ResponsablesClients { get; set; }
}
and the ResponsablesClient as :
public partial class ResponsablesClient
{
public int Id { get; set; }
[StringLength(10)]
[ScaffoldColumn(false)]
public string CodeClient { get; set; }
[StringLength(50)]
[DisplayName("Nom complet")]
[Required]
public string Nom { get; set; }
public virtual Client Client { get; set; }
}
my controller create (httpget) method :
public ActionResult Create()
{
return View();
}
When i want to create a new client i use a strongly typed view of type client, and in that view i add dynamically strongly typed partial views . In the create httpPost the Client model i get contains Client properties but not a list of responsablesClients , here is the minimized view :
<div class="form-group">
@Html.LabelFor(model => model.Name, new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.TextBoxFor(model => model.Name, new {@class="form-control"})
@Html.ValidationMessageFor(model => model.Name)
</div>
</div>
<div class="form-horizontal" style="margin-top: 50px">
<h4>Responsables</h4>
<hr/>
<div id="responsables">
<div id="responsable0">
@Html.Partial("_ResponsableCreate",new ResponsablesClient())
</div>
</div>
</div>
so my question how can i get that list of ResponsablesClient without creating a custom view as :
public Client client {get;set;}
public List<ResponsablesClient> responsablesClient {get;set;}