Click here to Skip to main content
14,732,615 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Guys, I tried but i does not get the required Answer.  I have the RadioButtonList and Two DropdownLists.
<asp:RadioButtonList ID="rbnl" runat="server" RepeatDirection="Horizontal">
                                <asp:ListItem Text="Fresher" Value="0" Selected="True"></asp:ListItem>
                                <asp:ListItem Text="Experience" Value="1"></asp:ListItem>
                            </asp:RadioButtonList>


<asp:DropDownList ID="ddlMin" runat="server" Width="70px">
                                <asp:ListItem Text="" Value="0"></asp:ListItem>
                                <asp:ListItem Text="1" Value="1"></asp:ListItem>
                                                           </asp:DropDownList>


<asp:DropDownList ID="ddlMax" runat="server" Width="70px">
                                <asp:ListItem Text="" Value="0"></asp:ListItem>
                                <asp:ListItem Text="1" Value="1"></asp:ListItem>
                                                                                                                          </asp:DropDownList>

in Page load: if selected Text of Radionbuttonlist is "Fresher" then disabled the Dropdownlist.

my requirement is using jquery i want enable the DropdownLists. when selecting the "Experience".


Please any one help me.
Posted
Updated 1-Nov-12 21:44pm
v3

<asp:RadioButtonList class="radClas" ID="rbnl" runat="server" RepeatDirection="Horizontal">
                                <asp:ListItem Text="Fresher" Value="0" Selected="True"></asp:ListItem>
                                <asp:ListItem Text="Experience" Value="1"></asp:ListItem>
                            </asp:RadioButtonList>


<asp:dropdownlist cssclass="drpClassOne" id="ddlMin" runat="server" width="70px" xmlns:asp="#unknown">
                                <asp:listitem text="" value="0"></asp:listitem>
                                <asp:listitem text="1" value="1"></asp:listitem>
                                                           </asp:dropdownlist>

<asp:dropdownlist cssclass="drpClassTwo" id="ddlMax" runat="server" width="70px" xmlns:asp="#unknown">
                                <asp:listitem text="" value="0"></asp:listitem>
                                <asp:listitem text="1" value="1"></asp:listitem>
                                                                                                                          </asp:dropdownlist>

$(document).ready(function(){
      $(".radClass").clck(function(){
          //Here check the text of radio button. use debugger
          if()// if text is Experience 
            {
              $(".drpClassOne").attr("disabled","enabled");
              $(".drpClassTwo").attr("disabled","enabled");
            }
      });

   });
   
Its working check it :-)

<script type="text/javascript">
         $(function () {
             $('#<%=ddlMin.ClientID %>').attr("disabled", true);
             $('#<%=ddlMax.ClientID %>').attr("disabled", true);
             $('#<%=rbnl.ClientID %>').click(function (e) {
                 if ($(this).find("input:checked").val() == "0") {
                     $('#<%=ddlMin.ClientID %>').attr("disabled", true);
                     $('#<%=ddlMax.ClientID %>').attr("disabled", true);
                  }
                 else if ($(this).find("input:checked").val() == "1") {
                     $('#<%=ddlMin.ClientID %>').attr("disabled", false);
                     $('#<%=ddlMax.ClientID %>').attr("disabled", false);
                 }

             });
         });
         

    </script>
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900