Wednesday, September 6

asp:RangeValidator gotcha!!!

I was using rangevalidator in my user controls.

the ranges I was setting was
0 - 49
0 - 100
For some reason, the validator for (0-100) range was validating only 0 & 100 and invalidating the rest. It wasn't clear to me why it wasn't working for 0-100 while it was working for 0-49.

Both being part of same user control there was no discrepancy in settings of the control.

After searching on the net I found that one has to set the "Type" property of the asp:RangeValidator to "Integer" apart from setting the "MaximumValue" and "MinimumValue", in order for it to consistantly work for any range of integers.

Other Type options are
Currency
Date
Double
Integer
String

Comments: Post a Comment

Subscribe to Post Comments [Atom]





<< Home

This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]