here is my code in asp.net… when it renders the code i have a [checkbox] with [dropdownlist] by default all the dropdownlist disabled when the page loads by doing like this:
var $ddls = $('select');
$ddls.prop("disabled", true);
my question is: how to enabled the dropdown only when the checkbox is checked? and if the checkbox is unchecked then disabled the dropdown
<asp:GridView ID="routePlanGridView" runat="server" AutoGenerateColumns="False"
<Columns>
<asp:TemplateField HeaderText="Reason">
<ItemTemplate>
<div class="selectreason">
<asp:CheckBox CssClass="selectme" ID="chkReject" runat="server" Checked="false">
</asp:CheckBox>
<asp:DropDownList runat="server" ID="detail" >
<asp:ListItem Selected="True" Value="0">Select me</asp:ListItem>
<asp:ListItem Value="1">one</asp:ListItem>
<asp:ListItem Value="2">two</asp:ListItem>
<asp:ListItem Value="3">three</asp:ListItem>
<asp:ListItem Value="4">four</asp:ListItem>
</asp:DropDownList>
</div>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
I would do this in the
RowDataBoundevent.The
toggleSelectListfunction would look something like this: