Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / March 2008

Tip: Looking for answers? Try searching our database.

Why RangeValidator and RegularExpression cannot validate null     values??

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
lander - 06 Mar 2008 14:42 GMT
For example:

http://quickstarts.asp.net/QuickStartv20/aspnet/samples/ctrlref/validation/Range
Validator/RangeValidator1_cs.aspx


How can make it validate null values easily???

thanks!
Mark Fitzpatrick - 06 Mar 2008 14:50 GMT
It's their job to ensure that a value passed to them is valid. Since no
value is passed, how can it be invalid? It's not their job to ensure that
there is data in a field, that's the job of the RequiredField Validator.
This let's you do things like have an optional email address field that
checks the formatting through a regular expression validator. Since they
don't have to fill it in, you wouldn't want an error reported to them about
incorrect email address. If you don't want it optional, you place a
requiredfield validator there. Then it will always make sure that first,
there's a value there, then second, the value matches the range or regular
expression validator.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - Expression

> For example:
>
[quoted text clipped - 3 lines]
>
> thanks!

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.