4
I need to create a multi-field Insert at the same time! My system has several tables and relationships and I am struggling at this point. I have this registration screen: With that code:
@using (Html.BeginForm()){
<div style="width: 100%; float: left;">
<table class="table table-bordered table-hover">
<thead>
<tr>
<th style="width:200px; text-align:center; vertical-align:middle;">Alunos</th>
<th style="width:150px; text-align:center; vertical-align:middle;">Atribuir Nota</th>
</tr>
</thead>
<tbody>
@{
for (int i = 0; i < Model.ListaMatriculas.Count(); i++)
{
<tr>
<td>@Model.ListaMatriculas[i].Aluno.Nome</td>
<td style="text-align:center;">
<input type="hidden" name="Matricula.IdMatricula" value="@Model.ListaMatriculas[i].IdMatricula" />
<input type="text" name="Nota" value="0" style="width: 30px;" />
@Html.DropDownList("UnidadeCurricular.IdUnidadeCurricular", ViewBag.unidadecurricular_idunidadecurricular as SelectList, "")
</td>
</tr>
}
}
</tbody>
</table>
<div class="alert alert-success">
<b>Obs: Notas devem possuir valores de 0 a 100.</b>
</div>
</div>
<div style="width: 100%;">
<button class="btn btn-sucsess " type="submit">Salvar</button>
</div>
}
However when I click on send my controller does not receive the values of the fields, someone can give me a Help, how can I do something like that? An example link or something...
you should add new input fields dynamically? this? Or just the fields that are in "Listrmatriculas" ?
– Rod