Tim Maxey .NET Technology Blog & Resources
April 2008 Entries
The Code on the Client:
<script language=javascript>
function validate(chkid){
if (document.getElementById(chkid).checked){
return true;
}
else {
alert("You didn't check the box...")
return false;
}
}
</script>
Now on your Button Control on the form OnLoad event add this:
If Not Page.IsPostBack Then
Button1.Attributes.Add("onClick", "return validate('" & CheckBox1.ClientID & "');")
End If