Re: CompareValidator DataTypeCheck requires value?
- From: "Ron Weldy" <ronweldy@xxxxxxx>
- Date: Sun, 5 Jun 2005 23:32:59 -0700
I found the problem and have fixed it. It did not have anything to do with
this, but with some downstream processing. DOH!
"Ron Weldy" <ronweldy@xxxxxxx> wrote in message
news:ek6Jb2faFHA.3032@xxxxxxxxxxxxxxxxxxxxxxx
>I want to have a optional field on a form that can be blank but if the user
>enters something, it must be a number. I'm using a CompareValidator with
>the datatype check but if I submit the form with no value in the field it
>throws an error. If I put a number in the form submits fine, and a
>non-numeric will trigger the validation. But blank causes the nasty error
>page to come up with the error " Input string was not in a correct format."
>
> Can this be done?
>
> Here is my code:
>
> <code>
>
> <asp:TextBox id=txtCOB maxLength="3" CssClass="TxtFld" Runat="server"
> size="2"></asp:TextBox>
> <asp:CompareValidator runat="server"
> ControlToValidate="txtCOB"
> EnableClientScript="True"
> id="valCoB"
> CssClass="ErrMsg"
> ErrorMessage="Please enter a number"
> Operator="DataTypeCheck"
> Type=Integer>*</asp:CompareValidator>
>
> </code>
>
.
- References:
- CompareValidator DataTypeCheck requires value?
- From: Ron Weldy
- CompareValidator DataTypeCheck requires value?
- Prev by Date: OWC10.ChartSpaceClass.ExportPicture - Access Denied Error
- Next by Date: Re: How to add a column to a DataTable
- Previous by thread: CompareValidator DataTypeCheck requires value?
- Next by thread: How can we get the use's IP and computer name
- Index(es):