Click here to Skip to main content
15,893,588 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
when i click on checkbox Click then value of checkbox4 displayed to checkbox5
my question is that when i unclick Checkbox CLICK then value of checkbox 5 should be display back to checkbox 4


XML
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>

    <script type="text/javascript">
     function rblSelectedValue() {
         var radio = document.getElementsByName('RadioButtonList1');
         for (var i = 0; i < radio.length; i++) {
             if (radio[i].checked == true) {
                 // document.getElementById('txt1').value = radio[i].value;
                 //document.getElementById('txt1').value = document.getElementById('<%=RadioButtonList2.ClientID%>').value;
                 var value1 = radio[i].value
                 var radio1 = document.getElementsByName('RadioButtonList2');
                 radio1[i].value = value1;
                 radio1[i].checked = true;
                 //alert(radio[i].value);
                 var CheckBox4 = document.getElementById("CheckBox4");
                 var CheckBox5 = document.getElementById("CheckBox5");
                 if (CheckBox4.checked == true)
                 {
                     CheckBox5.checked = true;
                 }

             }


         }

     }

    </script>

</head>

<body>
    <form id="form1" runat="server">
    <div>

    </div>
    <asp:radiobuttonlist id="RadioButtonList1" runat="server">
        <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:radiobuttonlist>
    &nbsp;&nbsp;<br />
    <asp:CheckBox ID="CheckBox1" runat="server" onclick="rblSelectedValue();"
        Text="click" />
&nbsp;<asp:RadioButtonList ID="RadioButtonList2"  runat="server">
        <asp:ListItem Value="yes">yes</asp:ListItem>
        <asp:ListItem Value="no" >no</asp:ListItem>
    </asp:RadioButtonList>

    <asp:CheckBox ID="CheckBox4" runat="server" />
    <asp:CheckBox ID="CheckBox5" runat="server" />

    </form>
</body>
</html>
Posted
Updated 28-Aug-13 0:42am
v2
Comments
Mann Rai 28-Aug-13 7:04am    
plz help me its urgent
ZurdoDev 28-Aug-13 7:17am    
That doesn't make any sense. Can you explain where you are stuck?
Mann Rai 28-Aug-13 7:21am    
when i uncheck the checkbox Click then value of checkbox5 should be transfer into checkbox4

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