473,659 Members | 2,671 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1349

"angus" <an***@angus.co m> wrote in message news:OR******** ******@TK2MSFTN GP10.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.
<extendedvalida tors:RequiredFi eldValidator id="RequiredFie ldValidator2"
runat="server" ErrorMessage="t ype something" ControlToValida te="TextBox1"
group="1"></extendedvalidat ors:RequiredFie ldValidator>

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**********@ho tmail.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.co m> wrote in message
news:OR******** ******@TK2MSFTN GP10.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 RequiredFieldVa lidators 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 misunderstandin g your question and giving you an erroneous
answer for your situation.

HTH,

Raymond Lewallen

"angus" <an***@angus.co m> wrote in message
news:OR******** ******@TK2MSFTN GP10.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 causesValidatio n set to true is pressed.
"Raymond Lewallen" <Ra************ ******@nospam.f aa.gov> wrote in message
news:eF******** ******@TK2MSFTN GP10.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 RequiredFieldVa lidators 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 misunderstandin g your question and giving you an erroneous answer for your situation.

HTH,

Raymond Lewallen

"angus" <an***@angus.co m> wrote in message
news:OR******** ******@TK2MSFTN GP10.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
causesValidatio n 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******** *****@TK2MSFTNG P11.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 causesValidatio n set to true is pressed.

"Raymond Lewallen" <Ra************ ******@nospam.f aa.gov> wrote in message
news:eF******** ******@TK2MSFTN GP10.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 RequiredFieldVa lidators 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 misunderstandin g your question and giving you an

erroneous
answer for your situation.

HTH,

Raymond Lewallen

"angus" <an***@angus.co m> wrote in message
news:OR******** ******@TK2MSFTN GP10.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 customdatasolut ions dot us
"angus" <an***@angus.co m> wrote in message
news:OR******** ******@TK2MSFTN GP10.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 "Profession al 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****@PeterBlu m.com
Creator of "Profession al Validation And More" at
http://www.peterblum.com/vam/home.aspx

"angus" <an***@angus.co m> wrote in message
news:OR******** ******@TK2MSFTN GP10.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
2017
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 controls and validators are then added to a table for display to the user. This code did seem to work originally, but now does not amd I am stumped as to why. There have been some code changes, but not to the methods below and I have pretty much...
0
1909
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 controls and validators are then added to a table for display to the user. This code did seem to work originally, but now does not amd I am stumped as to why. There have been some code changes, but not to the methods below and I have pretty much...
2
1784
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 System.Web.UI.WebControls.RequiredFieldValidator and attempting to cast it into an IValidator and/or a BaseValidator. Both casting attempts have failed miserably, throwing an InvalidCastException ... how can it be i cannot cast to the base class of my instance ???
2
1597
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 clicks on the submit button. Thanks, Ely
6
1620
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 have a default RED font that appears to be difficult to remove. We could hard code in a blank font color into the .aspx html for each validator, but that would defeat the purpose of the CSS. Is there a way to change the default RED color of...
3
1526
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 has required validators for name, address, etc... The next section is the "BRONZE MEMBER" section. It also has required validators for the same fields. The user only has to fill out 1 set of info. Any thoughts on how to accomplish this?
3
1866
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 validators on the page fire which i don't want - i've tried to make them invisible - this hides the controls but i get a strange error when i click the Update column - i tried to disable them - they become disabled but i can see my error "*" appearing next...
5
3670
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 I thought I would ask here for advice. - ValidationSummary When there are validation errors on the page, the summary control displays its HeaderText at the top of my form. However, it lists each validation problem. Additionally each error...
1
1660
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 the currently selected pageview of the multipage. To prevent this from happening I disable all the validators and only enable the validators on the selected page but does not look to me like the correct way of working. Is there a better way to...
0
8851
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8535
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8629
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7360
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5650
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4176
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4338
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2757
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1982
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.