5
I am developing a site with ASP.NET MVC and Razor, I have in one of my pages a table with some columns.
I have in this table a State column whose has a Checkbox and another column containing a Dropdownlist with some options.
I would like to change the value of the Dropdownlist, the value of the Checkbox was also changed to check, because I use the checked lines to send to the controller.
I’ve tried using the parents (Jquery) in the element, but I get an answer that parents don’t support.
Could someone help?
VIEW
<table class="table table-condensed table-bordered table-striped table-hover table-reflow">
<thead class="thead-inverse">
<tr>
<th class="text-center bs-checkbox"><input type="checkbox" /></th>
<th class="text-center col-md-5">Emitente</th>
<th class="text-center">Manifestação</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model.listaManifestacao)
{
<tr id="@item.Id">
<td class="text-center">
<div class="bs-checkbox"><input type="checkbox" /></div>
</td>
<td class="text-center">@item.Emitente</td>
<td class="text-center">
@Html.DropDownListFor(m => item.CodigoEvento, new SelectList(Model.listaOpcoesManifestacao, "Id", "Descricao", item.CodigoEvento), new { @class = "form-control", onchange = "CheckState(this);" })
</td>
</tr>
}
</tbody>
</table>
My problem is the table where the fields meet. I need to take the dropdownlist value of the row that was changed and change the checkbox value on the same row of the table and I’m not able to do that. Your code works right, but my problem also involves navigation by table.
– Jefferson Pedro
You can paste the code sff?
– Pedro Luzio
You can enter the code sff?
– Pedro Luzio
View code posted, I gave a simplified, because my table has several columns, so I removed some to not get too much code
– Jefferson Pedro