Hello first time asking for help in stackoverflow. My question is this , how will I get the value or model of the selected checkbox.
<dl class="dl-horizontal">
@foreach (Produto prod in (Model.ProdutosEntrada))
{
<dt>
@Html.DisplayNameFor(model => prod.Designacao)
</dt>
<dd>
@Html.DisplayFor(model => prod.Designacao)
</dd>
<dt>
@Html.DisplayNameFor(model => prod.Descricao)
</dt>
<dd>
@Html.DisplayFor(model => prod.Descricao)
</dd>
foreach (EntradaProduto entProd in (Model.EntradaProdutoEscolhida))
{
if (prod.CodigodoProduto == entProd.CodigodoProduto)
{
<dt>
@Html.DisplayNameFor(model => entProd.Quantidade)
</dt>
<dd>
@Html.DisplayFor(model => entProd.Quantidade)
</dd>
<dt>
@Html.DisplayNameFor(model => entProd.Validado)
</dt>
<dd>
<input type="checkbox" name="prodValidados" id="@entProd.CodigodoProduto" value="@entProd.Validado"/>*@
</dd>
}
}
}
</dl>
This is the code in the view, i dont know how to redirect to the action and catch the values from the checkboxes.
public ActionResult AtualizarValidado(bool[] prodValidados)
{
return null;
}
This is the action, i tried to pass as a argument an array with the same name as the checkbox, but is always null.
If you could help me, will be nice, since i am blocked in this problem for a while.
Aucun commentaire:
Enregistrer un commentaire