By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,463 Members | 2,858 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,463 IT Pros & Developers. It's quick & easy.

Question about validators

P: n/a
Dear all,

I have 5 textboxes, and 2 buttons in a webform.

1-3 textboxes would be validated by 3 Required Field Validators if button 1
is click;
4-5 textboxes would be validated by 2 Required Field Validators if button 2
is click.

I have found whether i click button 1 or button 2, textboxes 1-5 will be
validated.

What can i do if i want to validate those textboxes separately.

Thank you.

Regards,
Angus
Nov 18 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a

"angus" <an***@angus.com> wrote in message news:OR**************@TK2MSFTNGP10.phx.gbl...
Dear all,

I have 5 textboxes, and 2 buttons in a webform.

1-3 textboxes would be validated by 3 Required Field Validators if button 1
is click;
4-5 textboxes would be validated by 2 Required Field Validators if button 2
is click.

I have found whether i click button 1 or button 2, textboxes 1-5 will be
validated.

What can i do if i want to validate those textboxes separately.

Thank you.

Regards,
Angus


1) wait for Whidbey, which apparently has validator groups
2) use (server-side) custom validators, maybe this will work:
- two custom validators, one for each group of textboxes. they check
if every textbox in it's group is non-empty
- in the onclick event, do not check Page.IsValid, but check
the specific validator (set the other to "valid")
Hans Kesting
Nov 18 '05 #2

P: n/a
Hi angus
The validators that come with .net don't do this
I've developed a set of validator controls that allow you to group them into
logical forms.

e.g.
<extendedvalidators:RequiredFieldValidator id="RequiredFieldValidator2"
runat="server" ErrorMessage="type something" ControlToValidate="TextBox1"
group="1"></extendedvalidators:RequiredFieldValidator>

In the future I'd like to sell them (after a bit more testing). So far a
couple of people who have posted similar questions have found that they
work.
If you like to try them mail me at jo**********@hotmail.com and I'll send
you the dll, let me know if you are using visual studio version 2002 or 2003
Cheers
Joe Gass
MCSD.net

"angus" <an***@angus.com> wrote in message
news:OR**************@TK2MSFTNGP10.phx.gbl...
Dear all,

I have 5 textboxes, and 2 buttons in a webform.

1-3 textboxes would be validated by 3 Required Field Validators if button 1 is click;
4-5 textboxes would be validated by 2 Required Field Validators if button 2 is click.

I have found whether i click button 1 or button 2, textboxes 1-5 will be
validated.

What can i do if i want to validate those textboxes separately.

Thank you.

Regards,
Angus

Nov 18 '05 #3

P: n/a
Angus,

I'm not sure what Hans and Joe Gass are meaning when they say you can't do
this. Maybe I'm not understanding your question, but I have no problem
setting the Enable and Visible properties of RequiredFieldValidators to
false or true and only firing off the ones I need given a particular
scenario, such as clicking button 1 or button 2. I've been doing my app
this way for almost 2 years now. You might give that a try.

I'm sorry if I am misunderstanding your question and giving you an erroneous
answer for your situation.

HTH,

Raymond Lewallen

"angus" <an***@angus.com> wrote in message
news:OR**************@TK2MSFTNGP10.phx.gbl...
Dear all,

I have 5 textboxes, and 2 buttons in a webform.

1-3 textboxes would be validated by 3 Required Field Validators if button 1 is click;
4-5 textboxes would be validated by 2 Required Field Validators if button 2 is click.

I have found whether i click button 1 or button 2, textboxes 1-5 will be
validated.

What can i do if i want to validate those textboxes separately.

Thank you.

Regards,
Angus

Nov 18 '05 #4

P: n/a
Raymond, I think you are talking about setting the enabled or visible
properties off on the server side.
If you use client side validation with the regular .net validators all the
validators fire when a button with causesValidation set to true is pressed.
"Raymond Lewallen" <Ra******************@nospam.faa.gov> wrote in message
news:eF**************@TK2MSFTNGP10.phx.gbl...
Angus,

I'm not sure what Hans and Joe Gass are meaning when they say you can't do
this. Maybe I'm not understanding your question, but I have no problem
setting the Enable and Visible properties of RequiredFieldValidators to
false or true and only firing off the ones I need given a particular
scenario, such as clicking button 1 or button 2. I've been doing my app
this way for almost 2 years now. You might give that a try.

I'm sorry if I am misunderstanding your question and giving you an erroneous answer for your situation.

HTH,

Raymond Lewallen

"angus" <an***@angus.com> wrote in message
news:OR**************@TK2MSFTNGP10.phx.gbl...
Dear all,

I have 5 textboxes, and 2 buttons in a webform.

1-3 textboxes would be validated by 3 Required Field Validators if
button 1
is click;
4-5 textboxes would be validated by 2 Required Field Validators if
button 2
is click.

I have found whether i click button 1 or button 2, textboxes 1-5 will be
validated.

What can i do if i want to validate those textboxes separately.

Thank you.

Regards,
Angus


Nov 18 '05 #5

P: n/a
Joe, you are correct. I am changing those server side. Can he set
causesValidation to False on the button, and then on the click event handler
sub for the button, enable or disable the validators he needs fired and then
call Page.IsValid? Its been a long while since I've looked at my code that
does that, but I think that is how I handle it for those types of scenarios.

Thanks for your clarification,

Raymond Lewallen

"Joe Gass" <jo*@dontspamme.com> wrote in message
news:OD*************@TK2MSFTNGP11.phx.gbl...
Raymond, I think you are talking about setting the enabled or visible
properties off on the server side.
If you use client side validation with the regular .net validators all the
validators fire when a button with causesValidation set to true is pressed.

"Raymond Lewallen" <Ra******************@nospam.faa.gov> wrote in message
news:eF**************@TK2MSFTNGP10.phx.gbl...
Angus,

I'm not sure what Hans and Joe Gass are meaning when they say you can't do this. Maybe I'm not understanding your question, but I have no problem
setting the Enable and Visible properties of RequiredFieldValidators to
false or true and only firing off the ones I need given a particular
scenario, such as clicking button 1 or button 2. I've been doing my app
this way for almost 2 years now. You might give that a try.

I'm sorry if I am misunderstanding your question and giving you an

erroneous
answer for your situation.

HTH,

Raymond Lewallen

"angus" <an***@angus.com> wrote in message
news:OR**************@TK2MSFTNGP10.phx.gbl...
Dear all,

I have 5 textboxes, and 2 buttons in a webform.

1-3 textboxes would be validated by 3 Required Field Validators if

button
1
is click;
4-5 textboxes would be validated by 2 Required Field Validators if

button
2
is click.

I have found whether i click button 1 or button 2, textboxes 1-5 will be validated.

What can i do if i want to validate those textboxes separately.

Thank you.

Regards,
Angus



Nov 18 '05 #6

P: n/a
Check out my post in the thread 'validating portions of asp.net page' on Jan
5.
It might be what you are looking for.

--

Alphonse Giambrone
Email: a-giam at customdatasolutions dot us
"angus" <an***@angus.com> wrote in message
news:OR**************@TK2MSFTNGP10.phx.gbl...
Dear all,

I have 5 textboxes, and 2 buttons in a webform.

1-3 textboxes would be validated by 3 Required Field Validators if button 1 is click;
4-5 textboxes would be validated by 2 Required Field Validators if button 2 is click.

I have found whether i click button 1 or button 2, textboxes 1-5 will be
validated.

What can i do if i want to validate those textboxes separately.

Thank you.

Regards,
Angus

Nov 18 '05 #7

P: n/a
The concept you are looking for is "validation groups". It has been
identified in several forms in this thread.
- ASP.NET 2.0
- Joe Gass's future product

There are several shipping products that replace Microsoft's validators with
support for validation groups. Mine is "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx. It overcomes the limitations of
Microsoft's validators. Those limitations are covered here:
http://www.peterblum.com/vam/valmain.aspx.

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

"angus" <an***@angus.com> wrote in message
news:OR**************@TK2MSFTNGP10.phx.gbl...
Dear all,

I have 5 textboxes, and 2 buttons in a webform.

1-3 textboxes would be validated by 3 Required Field Validators if button 1 is click;
4-5 textboxes would be validated by 2 Required Field Validators if button 2 is click.

I have found whether i click button 1 or button 2, textboxes 1-5 will be
validated.

What can i do if i want to validate those textboxes separately.

Thank you.

Regards,
Angus

Nov 18 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.