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

How to highlight selected text in notepad++

  –> To highlight a block of code in Notepad++, please do the following steps step-1  :- Select the required text. step-2  :- Right click...