2
I have the following Dropdownlist:
<div class="editor-field">
@Html.DropDownList("ProdutoId", String.Empty)
</div>
And this jQuery function that when the user presses the button will pick up the selected value and play in a table:
function AddRow()
{
var produto = $("ProdutoId")
$('#tabelaPedidos').append('<tr><td>' + produto + '</td><td>teste</td></tr>')
}
But I can’t get the Dropdownlist ID to get the selected value...
As soon as I fill out my Dropdownlist
ViewBag.ProdutoId = new SelectList(context.Produtos, "ID", "Nome", pedido.ProdutoId);
which html is generated with the command "@Html.Dropdownlist("Produtoid", String.Empty)"?
– Fernando Rangel
A dropdownlist with my products loaded...
– Daniel