M
mc
I've not been able to get a Check box to client side validated on postback. with my changes I can
get it to work on the serverside ok but not on the client.
I have created a new control as below:-
[ValidationProperty("ValidationValue")]
public class ValidifiableCheckBox: CheckBox
{
public string ValidationValue{
get { return (this.checked ? bool.TrueString : string.Empty); }
}
}
this gives me a CheckBox that the Validators will except (rather than throwing an exception about
not being able to validate them), If I use it with a RequiredFieldValidator, the Serverside events
valdiation works however it doesn't seem to trap it on the client, my page code is bellow: -
<myControls:ValidifiableCheckBox ID="cbAgree" runat="server"/>
<asp:RequiredFiledValidator ID="rfvAgree" runat="server" ControlToValidate="cbAgree"
ErrorMessage="Oh Dear" Text="*"/>
<asp:ValidationSummary ID="vsAgree" runat="server" ShowMessageBox="true" ShowSummary="false"/>
Any ideas?
Why did microsoft not make the CheckBox control validatable?
get it to work on the serverside ok but not on the client.
I have created a new control as below:-
[ValidationProperty("ValidationValue")]
public class ValidifiableCheckBox: CheckBox
{
public string ValidationValue{
get { return (this.checked ? bool.TrueString : string.Empty); }
}
}
this gives me a CheckBox that the Validators will except (rather than throwing an exception about
not being able to validate them), If I use it with a RequiredFieldValidator, the Serverside events
valdiation works however it doesn't seem to trap it on the client, my page code is bellow: -
<myControls:ValidifiableCheckBox ID="cbAgree" runat="server"/>
<asp:RequiredFiledValidator ID="rfvAgree" runat="server" ControlToValidate="cbAgree"
ErrorMessage="Oh Dear" Text="*"/>
<asp:ValidationSummary ID="vsAgree" runat="server" ShowMessageBox="true" ShowSummary="false"/>
Any ideas?
Why did microsoft not make the CheckBox control validatable?