Click here to Skip to main content
15,942,710 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>



<%--<script type="text/javascript">

i have checkboxes


</script>--%>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:CheckBox ID="chk1" runat="server" Text="IAS" />
&nbsp;<asp:CheckBox ID="chk2" runat="server" Text="PCS" />
        <br />
        <br />
        <br />
        <br />
        <asp:CheckBox ID="chk3" runat="server" Text="This is IAS" />
&nbsp;<asp:CheckBox ID="chk4" runat="server" Text="This is PCS" />
    </div>
    </form>
</body>

</html>
Posted
Comments
vinay.tatipamula 26-Aug-13 7:08am    
Your question is not clear..
Ahmed Alaa El-Din 26-Aug-13 7:32am    
please add more explanation..
Mann Rai 26-Aug-13 8:00am    
if i check checkbox IAS then checkbox THis is IAS checkbox should be selected

Catch the click event of the chk1 using javascript, and in that event, you should write the code through which you can 'check' the value of chk3 checkbox. for example

checkBox1Checked()
{
chk3.checked = true;
}

You can call bind this with the checkbox1 as
<asp:checkbox onclick="javascript:checkbox1Clicked();" id="chk1" runat="server" text="IAS" xmlns:asp="#unknown" />

Note: remove xmlns:asp="#unknown" from above line. I don't know why it is getting added here.
 
Share this answer
 
v2
Try:-

XML
<asp:CheckBox ID="chk1" onclick="chkSlct();" runat="server" Text="IAS" />
 <asp:CheckBox ID="chk2" runat="server" Text="PCS" />
        <br />
        <br />
        <br />
        <br />
        <asp:CheckBox ID="chk3" runat="server" Text="This is IAS" />
 <asp:CheckBox ID="chk4" runat="server" Text="This is PCS" />

function chkSlct() {

        if (document.getElementById("<%=chk1.ClientID%>").checked == "true") {
            document.getElementById("<%=chk3.ClientID%>").checked = true; 
        }

    }
 
Share this answer
 
v2
Comments
Mann Rai 26-Aug-13 8:43am    
this is not working
TrushnaK 26-Aug-13 8:54am    
nw try
Here is the code and make sure you added jquery library

C#
$(document).ready(function (){
  $("#chk1").click(function() {
    $("#chk3").checked(true);
  });
});
 
Share this answer
 

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