E
epigram
I'm trying to use the ASP.NET validators to check some client-side business
rules. I've got two ASP TextBox controls (call them tbxYear1 and tbxYear2)
used to enter a range of years. I've got a couple things I need to check:
1) tbxYear1 and tbxYear2 are both optional, but if values are entered they
have to integers and non-negative
2) if values are entered for both tbxYear1 and tbxYear2 then tbxYear1 must
be less than tbxYear2
It looks like I can use a couple of the validator controls to, collectively,
make these checks. What I'd like to know is if there is a way to "short
circuit" the comparison sequences that multiple validator controls seem to
go through? For instance, if rule #1 is violated, then it probably doesn't
make sense to warn the user that rule #2 has also been violated.
I'm wondering if a CustomValidator control is the way to go here, but I'm
note sure. I assume this type of scenario happens all the time, so I'm
looking for a best practice.
Thanks!
rules. I've got two ASP TextBox controls (call them tbxYear1 and tbxYear2)
used to enter a range of years. I've got a couple things I need to check:
1) tbxYear1 and tbxYear2 are both optional, but if values are entered they
have to integers and non-negative
2) if values are entered for both tbxYear1 and tbxYear2 then tbxYear1 must
be less than tbxYear2
It looks like I can use a couple of the validator controls to, collectively,
make these checks. What I'd like to know is if there is a way to "short
circuit" the comparison sequences that multiple validator controls seem to
go through? For instance, if rule #1 is violated, then it probably doesn't
make sense to warn the user that rule #2 has also been violated.
I'm wondering if a CustomValidator control is the way to go here, but I'm
note sure. I assume this type of scenario happens all the time, so I'm
looking for a best practice.
Thanks!