Validation Suggestions??

G

Guest

This is a hard one for me, I am fairly new to C#/ASP.net and need some
suggestions!

I have 3 controls on a page, if control 'ivtshp' has a value it is valid and
requires 'ivrng' to have a value.

And if 'ivsurvnum' has a value then it is valid.

But ivtshp/ivrng and ivsurvnum can't both be valid.

So I need to validate ivtshp to say you must enter a valid number in ivrng,
I need to validate ivrng saying you must enter a valid number in ivtshp, and
I need to validate ivsurvnum saying you can't have a surv only and t/r search
at the same time.

Suggestions or Idea's????
 
K

Kevin Spencer

Sounds like you need a custom validation process. It could be either client-
or server-side. Whatever is most appropriate for your app.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.
 
W

WenJun Zhang[msft]

Hi Dewright,

As Kevin has mentioned, in ASP.NET we can perform user input validation for
controls through both clientside and serverside code. If you're wantting to
use ASP.NET's validation control to check the entry fields, we may need to
use custom validator if the validation logic is a bit complex. Otherwise,
we can just embeded our validation code in the page's codebehind code to do
the work as we expected. What's your current plan?

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
G

Guest

What I did end up doing is writing a series of if/else if/else functions in
my page submit function to loop through all of my box's.

I will next look at how to use this function with custom validators but at
this time this worked great.
 
K

Kevin Spencer

The built-in ASP.Net validation Controls are quite fine for most tasks.
However, when you get into a complex situation, you might spend as much time
getting them to work properly as you would "rolling your own" validation.
So, it sounds to me like (as Uncle Chutney would say ) you've hit the money
right on the head. ;-)

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.

What I did end up doing is writing a series of if/else if/else functions
in
my page submit function to loop through all of my box's.

I will next look at how to use this function with custom validators but at
this time this worked great.
--
D @ premierdata


"WenJun Zhang[msft]" said:
Hi Dewright,

As Kevin has mentioned, in ASP.NET we can perform user input validation
for
controls through both clientside and serverside code. If you're wantting
to
use ASP.NET's validation control to check the entry fields, we may need
to
use custom validator if the validation logic is a bit complex. Otherwise,
we can just embeded our validation code in the page's codebehind code to
do
the work as we expected. What's your current plan?

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
S

Steven Cheng[MSFT]

En, also if there are any other questions or anything else we can help,
please feel free to post here.

Good Luck:)

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
P

Peter Blum

There are many shortcomings to Microsoft's validators that force people to
write custom code. In your case, you will write a custom validator to handle
the logic.

I built a replacement to Microsoft's validators that addresses its
limitations called Professional Validation And More
(http://www.peterblum.com/vam/home.aspx). In your case, you will find that
each of its 25 validators has a property called Enabler where you setup a
rule that automatically enables the validator based on other conditions on
the page, like the RequiredTextValidator for 'ivrng' uses the Enabler to
monitor the text in 'ivtshp'.

--- Peter Blum
www.PeterBlum.com
Email: (e-mail address removed)
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,161
Latest member
GertrudeMa
Top