Good afternoon.
I need to get the value of a DropDownList
in a given column of a table.
This would be the table:
@model IEnumerable<Santander.Web.MVC.ValidacaoGanhadores.Models.Ganhadores>
<table id="tbValidacao">
<thead>
<tr style="height: 35px">
<td></td>
<td>Manter</td>
<td>Matricula</td>
<td>Nome</td>
<td>Status</td>
<td>Validado</td>
</tr>
</thead>
<tbody>
@{
var count = 1;
foreach (var item in Model)
{
@*item.Matricula.Contains("999") ? "Nao" : "Sim"*@
<tr style="height: 35px">
<td>@count</td>
<td>@Html.DropDownList("DropManter", listItems)</td>
<td>@Html.TextBox("txtMatricula", "", new { @readonly = "readonly" })</td>
<td>@Html.TextBox("txtNome", "", new { @readonly = "readonly" })</td>
<td>@Html.TextBox("txtStatus", "", new { @readonly = "readonly" })</td>
<td>@(item.Rede == "Rede SP Capital" ? 1 : 2)</td>
</tr>
count = count + 1;
}
}
</tbody>
</table>
The number of rows is variable, I need to get the value of this DropDownList
of each row as soon as it is changed.
I was trying the following way:
$('#tbValidacao tbody tr td').change(function () {
var conteudo = $('#DropManter option:selected').text();
alert(conteudo);
})
It always returns the value of the first line.