T
theresa
I'm about at my wits end trying to figure out why this isn't working,
so I'm hoping one of you can help! I'm sure there must be something
simple I'm missing.
I have a checkbox on an Asp.NET 2.0 web form that needs to be checked
before the form is successfully submitted. I've done the same thing on
an Asp.NET 1.1 form before and had no problems, but using the exact
same code on the 2.0 form absolutely nothing happens. No errors of any
kind (not even Javascript) and it acts the same in both Firefox and
IE. I've tried adding various test statements to the server-side
validation function (as indicated in the commented out code below),
but even those don't appear. I should add that all of the
RequiredFieldValidators on the page work just fine. Code below. Any
help is most appreciated!
<asp:CheckBox ID="chkStatement" runat="server" TextAlign="right" />
<asp:CustomValidator runat="server" id="custStatement"
OnServerValidate="reqStatement" ErrorMessage="* You must check the
checkbox."
Font-Bold="true" Font-Size="15" ForeColor="#FF0000" Display="dynamic"
'require the statement be checked before submission
Sub reqStatement(sender as Object, args as ServerValidateEventArgs)
args.IsValid = chkStatement.Checked
'response.write("reqStatement fired") [does nothing]
'args.IsValid = False [also does nothing]
End Sub
so I'm hoping one of you can help! I'm sure there must be something
simple I'm missing.
I have a checkbox on an Asp.NET 2.0 web form that needs to be checked
before the form is successfully submitted. I've done the same thing on
an Asp.NET 1.1 form before and had no problems, but using the exact
same code on the 2.0 form absolutely nothing happens. No errors of any
kind (not even Javascript) and it acts the same in both Firefox and
IE. I've tried adding various test statements to the server-side
validation function (as indicated in the commented out code below),
but even those don't appear. I should add that all of the
RequiredFieldValidators on the page work just fine. Code below. Any
help is most appreciated!
<asp:CheckBox ID="chkStatement" runat="server" TextAlign="right" />
<asp:CustomValidator runat="server" id="custStatement"
OnServerValidate="reqStatement" ErrorMessage="* You must check the
checkbox."
Font-Bold="true" Font-Size="15" ForeColor="#FF0000" Display="dynamic"
! </asp:CustomValidator>
'require the statement be checked before submission
Sub reqStatement(sender as Object, args as ServerValidateEventArgs)
args.IsValid = chkStatement.Checked
'response.write("reqStatement fired") [does nothing]
'args.IsValid = False [also does nothing]
End Sub