Friday, March 16, 2012

Optional ValidationExpression

Take the currency as example
Four dollar can be reprensented as

4
4.00

So what is the validationExpression for this?
If the . is there then user have to enter the last 2 digit too
else can enter as a digit alone.You could use a regular expression validator. Some examples can be found at:

http://regexlib.net

Or you could use a comparevalidator ... something like this:

<asp:comparevalidator id="CValidForCurrency" runat="server"
Type="Currency" ErrorMessage="* Not Currency Type"
ControlToValidate="txtAmount">Invalid Amount</asp:comparevalidator
HTH
Ronda

0 comments:

Post a Comment