473,396 Members | 1,605 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Question about validators

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
7 1339

"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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Tom Pearson | last post by:
I create controls and validators dynamically dependent on data at runtime. I create the control then the relevant validator(s) for it assigning the Control.ID as the control to validate. These...
0
by: Tom Pearson | last post by:
I create controls and validators dynamically dependent on data at runtime. I create the control then the relevant validator(s) for it assigning the Control.ID as the control to validate. These...
2
by: Angelos Karantzalis | last post by:
Hi guys, I'm trying to load a class instance dynamically, and then cast it to it's base type so I can use it in my app. More specifically, I'm dynamically instantiating a...
2
by: Ely | last post by:
When validating a control client side, is there a way to get the error message to display in the validation summary as soon as the control losses focus? Right now it only displays when the user...
6
by: Mark | last post by:
We have Validators embedded in an asp table server control. The table server control is necessary and cannot be replaced. We want to apply CSS formatting to the validators, but the validators...
3
by: VB Programmer | last post by:
Can you make a required field validator optional? I know it sounds crazy, but.... Let's say I have a signup form. It consists of 2 sections. The top section is a "GOLD MEMBER" section. It...
3
by: John Blair | last post by:
Hi, I have validators outside of a datagrid (for adding a new grid row) - however when i click "edit" column and then the "update" column of a grid row that has been edited - my other...
5
by: john.livermore | last post by:
I am successfully using the client side validation controls, but there are a couple aspects of their behavior that I wish to modify. I cannot see how to accomplish this through the properties, but...
1
by: Gabriel Lozano-Morán | last post by:
When using the tabstrip control combined with a multipage (several pageview) there is a problem when using validators. The problem is that validation also occurs on the validators that are not on...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.