This article to check checkbox is checked or uncheked on button click.I am using java script here to validate
checkbox on client side.
Lets take a checkbox
<asp:CheckBox ID="chkbox" runat="server" />
and a button
Now create function in java script like that.
<script type="text/javascript">
function ValidCheckbox() {
var d = document.getElementById('chkbox');
if (d.checked) {
return true;
}
else {
return false;
}
}
</script>
Now call the java script function on button click
<asp:Button ID="Button1" runat="server" OnClientClick="return ValidCheckbox()" Text="Button" />
Now run it and see the result...
checkbox on client side.
Lets take a checkbox
<asp:CheckBox ID="chkbox" runat="server" />
and a button
Now create function in java script like that.
<script type="text/javascript">
function ValidCheckbox() {
var d = document.getElementById('chkbox');
if (d.checked) {
return true;
}
else {
return false;
}
}
</script>
Now call the java script function on button click
<asp:Button ID="Button1" runat="server" OnClientClick="return ValidCheckbox()" Text="Button" />
Now run it and see the result...