0
Good afternoon.
I need to take the value of one DropDownList
in a given table column.
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 lines is variable, I need to take the value of this DropDownList
of each line, as soon as it is changed.
I was trying this way:
$('#tbValidacao tbody tr td').change(function () {
var conteudo = $('#DropManter option:selected').text();
alert(conteudo);
})
Only it always returns me the value of the first line.
You have the value for the Dropdown or the text that it displays?
– user3010128