Ciao a tutti.
Ho un problema di costruzione view Create.
Poniamo di avere un model :
codice:
public class Ticket
{
public int Id { get; set; }
[Required]
[DisplayName("Oggetto")]
public string Object { get; set; }
.
.
public virtual List<Reply> Replyes { get; set; }
}
public class Reply
{
public int Id { get; set; }
[Required]
[DisplayName("Ticket")]
public int Ticket_Id { get; set; }
[ForeignKey("Ticket_Id")]
public virtual Ticket Ticket { get; set; }
[Required]
[DisplayName("Testo")]
public string Text { get; set; }
}
Nella mia view riesco ad accedere correttamente a :
codice:
<div class="form-group">
@Html.LabelFor(model => model.Object, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Object, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Object, "", new { @class = "text-danger" })
</div>
</div>
Come faccio a creare il campo Text del model Reply sempre nella view create di Ticket
codice:
<div class="form-group">
@Html.LabelFor(model => model.???????, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.??????, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.???????, "", new { @class = "text-danger" })
</div>
</div>