Thursday 3 December 2015

How to set radiobuttonlist selected value and clear on check box changed event using jquery in asp.net



// HTML

<asp:CheckBox ID="CheckBox1" runat="server" Font-Bold="True" Text="Select" onchange="return SetRadios();"></asp:CheckBox>


<asp:RadioButtonList ID="rdBtnSHG" runat="server" Width="378px" RepeatDirection="Horizontal">
             <asp:ListItem Value="1">Add new</asp:ListItem>
              <asp:ListItem Value="2">Add+Update</asp:ListItem>

  </asp:RadioButtonList>






// JS
function SetRadios() {
      
            if ($('#<%=cbSHG.ClientID%>').is(":checked")) {
                $('[id*=rdBtnSHG]  :radio[value="1"] ').prop('checked', true);
            }
            else {
                $("#<%= rdBtnSHG.ClientID %> input[type=radio]").prop('checked', false);
            }           
             return false;

    }

No comments:

Post a Comment

Excel Sort values in ascending order using function TEXTJOIN

 Excel ::  Text ::  1,3,5,2,9,5,11 Result :: 1,2,3,5,5,9,11 Formula ::     TEXTJOIN ( ",",1,SORT(MID(SUBSTITUTE( A1 ,","...