473,748 Members | 4,951 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

need to have 'validation group'

On my page the user is ask to set of question.
Say there I have 2 controls like that
== pseudo-C#-code for my control ==
class MyControl : CompositeContro l
{
TextBox text;
LinkButton button

override void CreateChildCont rol()
{
text = new TextBox();
text.ID = "text"
Controls.Add(te xt);

button = new LinkButton();
buton.Text = submit;
button.Click = HCSubmit;
button.ID = "submit";

// == problem here
RequieredFieldV alidator rfv = new RequiredFieldVa lidator();
rfv.ControlToVe rify = "text";
Control.Add(rfv );
}
}
As you could see, text should have some value in it.
Now let's say I have 2 such control on the page and the user fill one and
press the submit link button, it won't be able to submit because the other
field would be empty.
Which is annoying.

Is there a way to limit the scope of the required field validator?
I coukld just remove it, but it provide nice features, so I'm wondering if
there is a solution to this problem, I have heard that ASP.NET 2.0 solve
it...
Feb 22 '06 #1
5 1907
In ASP.NET 2.0 there are validation groups which do exactly what you want.
For ASP.NET 1.x you are going to have to be more creative, using custom
validators rather than required field validators.

"Lloyd Dupont" <net.galador@ld > wrote in message
news:uT******** ******@TK2MSFTN GP14.phx.gbl...
On my page the user is ask to set of question.
Say there I have 2 controls like that
== pseudo-C#-code for my control ==
class MyControl : CompositeContro l
{
TextBox text;
LinkButton button

override void CreateChildCont rol()
{
text = new TextBox();
text.ID = "text"
Controls.Add(te xt);

button = new LinkButton();
buton.Text = submit;
button.Click = HCSubmit;
button.ID = "submit";

// == problem here
RequieredFieldV alidator rfv = new RequiredFieldVa lidator();
rfv.ControlToVe rify = "text";
Control.Add(rfv );
}
}
As you could see, text should have some value in it.
Now let's say I have 2 such control on the page and the user fill one and
press the submit link button, it won't be able to submit because the other
field would be empty.
Which is annoying.

Is there a way to limit the scope of the required field validator?
I coukld just remove it, but it provide nice features, so I'm wondering if
there is a solution to this problem, I have heard that ASP.NET 2.0 solve
it...

Feb 22 '06 #2
> In ASP.NET 2.0 there are validation groups which do exactly what you want.
Allright...
How does that work?
For ASP.NET 1.x you are going to have to be more creative, using custom
validators rather than required field validators.

"Lloyd Dupont" <net.galador@ld > wrote in message
news:uT******** ******@TK2MSFTN GP14.phx.gbl...
On my page the user is ask to set of question.
Say there I have 2 controls like that
== pseudo-C#-code for my control ==
class MyControl : CompositeContro l
{
TextBox text;
LinkButton button

override void CreateChildCont rol()
{
text = new TextBox();
text.ID = "text"
Controls.Add(te xt);

button = new LinkButton();
buton.Text = submit;
button.Click = HCSubmit;
button.ID = "submit";

// == problem here
RequieredFieldV alidator rfv = new RequiredFieldVa lidator();
rfv.ControlToVe rify = "text";
Control.Add(rfv );
}
}
As you could see, text should have some value in it.
Now let's say I have 2 such control on the page and the user fill one and
press the submit link button, it won't be able to submit because the
other field would be empty.
Which is annoying.

Is there a way to limit the scope of the required field validator?
I coukld just remove it, but it provide nice features, so I'm wondering
if there is a solution to this problem, I have heard that ASP.NET 2.0
solve it...


Feb 22 '06 #3
Hi Lloyd,

There are a couple of solutions for ASP.NET 1.1:

1. Use server side validation when the page is submitted to fire the
Validate() method of only the desired validators. This article -
http://aspalliance.com/699 - shows you how (along with many other validation
questions). See the topic "Several buttons associated with their own
validators".

2. I built a replacement to the ASP.NET validators that fixes the many
limitations I've found. Its called "Profession al Validation And More" (
http://www.peterblum.com/vam/home.aspx ). My validators have validation
groups. You simply assign a group name to the Group property on the submit
button and the associated validators. There are an enormous number of other
improvements I've made to validation and I include a utility to quickly
convert a page from your existing validators to mine.

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

"Lloyd Dupont" <net.galador@ld > wrote in message
news:uT******** ******@TK2MSFTN GP14.phx.gbl...
On my page the user is ask to set of question.
Say there I have 2 controls like that
== pseudo-C#-code for my control ==
class MyControl : CompositeContro l
{
TextBox text;
LinkButton button

override void CreateChildCont rol()
{
text = new TextBox();
text.ID = "text"
Controls.Add(te xt);

button = new LinkButton();
buton.Text = submit;
button.Click = HCSubmit;
button.ID = "submit";

// == problem here
RequieredFieldV alidator rfv = new RequiredFieldVa lidator();
rfv.ControlToVe rify = "text";
Control.Add(rfv );
}
}
As you could see, text should have some value in it.
Now let's say I have 2 such control on the page and the user fill one and
press the submit link button, it won't be able to submit because the other
field would be empty.
Which is annoying.

Is there a way to limit the scope of the required field validator?
I coukld just remove it, but it provide nice features, so I'm wondering if
there is a solution to this problem, I have heard that ASP.NET 2.0 solve
it...

Feb 23 '06 #4
Hi Peter,

Thanks for your links.
Anyway I'm using 2.0 and it's an home project so.. I will certainly go with
build in validation group in 2.0
"Peter Blum" <PL****@Blum.in fo> wrote in message
news:Or******** ******@TK2MSFTN GP15.phx.gbl...
Hi Lloyd,

There are a couple of solutions for ASP.NET 1.1:

1. Use server side validation when the page is submitted to fire the
Validate() method of only the desired validators. This article -
http://aspalliance.com/699 - shows you how (along with many other
validation questions). See the topic "Several buttons associated with
their own validators".

2. I built a replacement to the ASP.NET validators that fixes the many
limitations I've found. Its called "Profession al Validation And More" (
http://www.peterblum.com/vam/home.aspx ). My validators have validation
groups. You simply assign a group name to the Group property on the submit
button and the associated validators. There are an enormous number of
other improvements I've made to validation and I include a utility to
quickly convert a page from your existing validators to mine.

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

"Lloyd Dupont" <net.galador@ld > wrote in message
news:uT******** ******@TK2MSFTN GP14.phx.gbl...
On my page the user is ask to set of question.
Say there I have 2 controls like that
== pseudo-C#-code for my control ==
class MyControl : CompositeContro l
{
TextBox text;
LinkButton button

override void CreateChildCont rol()
{
text = new TextBox();
text.ID = "text"
Controls.Add(te xt);

button = new LinkButton();
buton.Text = submit;
button.Click = HCSubmit;
button.ID = "submit";

// == problem here
RequieredFieldV alidator rfv = new RequiredFieldVa lidator();
rfv.ControlToVe rify = "text";
Control.Add(rfv );
}
}
As you could see, text should have some value in it.
Now let's say I have 2 such control on the page and the user fill one and
press the submit link button, it won't be able to submit because the
other field would be empty.
Which is annoying.

Is there a way to limit the scope of the required field validator?
I coukld just remove it, but it provide nice features, so I'm wondering
if there is a solution to this problem, I have heard that ASP.NET 2.0
solve it...


Feb 23 '06 #5
As anyone was able to provide the (simple) answer let it be know it is very
simple.
BaseValidator and submiting control (LinkButton, Button, etc...) have a
string ValidationGroup { get; set;}
property.
Just fill it and... Voila!

--
Regards,
Lloyd Dupont

NovaMind development team
NovaMind Software
Mind Mapping Software
<www.nova-mind.com>
"Lloyd Dupont" <net.galador@ld > wrote in message
news:uT******** ******@TK2MSFTN GP14.phx.gbl...
On my page the user is ask to set of question.
Say there I have 2 controls like that
== pseudo-C#-code for my control ==
class MyControl : CompositeContro l
{
TextBox text;
LinkButton button

override void CreateChildCont rol()
{
text = new TextBox();
text.ID = "text"
Controls.Add(te xt);

button = new LinkButton();
buton.Text = submit;
button.Click = HCSubmit;
button.ID = "submit";

// == problem here
RequieredFieldV alidator rfv = new RequiredFieldVa lidator();
rfv.ControlToVe rify = "text";
Control.Add(rfv );
}
}
As you could see, text should have some value in it.
Now let's say I have 2 such control on the page and the user fill one and
press the submit link button, it won't be able to submit because the other
field would be empty.
Which is annoying.

Is there a way to limit the scope of the required field validator?
I coukld just remove it, but it provide nice features, so I'm wondering if
there is a solution to this problem, I have heard that ASP.NET 2.0 solve
it...

Feb 27 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1522
by: Czarina | last post by:
hi guys! here I am again, bugging you Here is where my page stands right now: http://www.gainesvillewebs.com/czar...h_results-2.htm The top 2 forms are working just fine, but the bottom one, with the check boxes, it not working I am by NO MEANS, a Javascript expert, so please be patient! Here is what it needs to do: It need to check that at least 1 checkbox is selected, and if not, display error message.
4
2005
by: Adrienne | last post by:
I am the first to admit that I know bupkis about javascript, except that sometimes I need it to do something client side that I can't do server side. Anyway, here's my problem: <input type="text" name="ticket" id="ticket"> <input type="text" name="amount" id="amount"> My ASP script defaults ticket to be 30.00 and amount to be 600.00. What
3
1117
by: Miljana | last post by:
Are modern browsers, except IE, supported in ASP.NET 2.0? I read in some article that ASP.NET 2.0 will support client-side validation not only in IE but other modern non-Microsoft browsers (Mozilla, Netscape, Opera...) but I can't find confirmation anywhere. Can enybody give me more information or post a link? Thanks in advance
1
3025
by: sck10 | last post by:
Hello, I have a button that is associated with a validation group. When I click the button and a validation fails, I still want to code to execute. Can this be done? Any help with this would be appreciate. Thanks in advance, Sck10 In my code behind: Sub Submit_Click(ByVal Sender As Object, ByVal Args As EventArgs)
18
3039
by: Q. John Chen | last post by:
I have Vidation Controls First One: Simple exluce certain special characters: say no a or b or c in the string: * Second One: I required date be entered in "MM/DD/YYYY" format: //+4 How ??
1
6954
by: Paul Aspinall | last post by:
Hi I want to put all my validation code in one place, for my FormView control, regardless of whether its editing or inserting data. Is there a 'Validation' event somewhere?? or do I point the ItemUpdating and ItemInserting events to the same place, and put my validation code there? Thanks
1
1321
by: Mukesh | last post by:
Currently i am developing a web application using asp.net1.1. I have developed several user control for this application . I am using validator in such user control. My problem is that whenever I use two controls ( both having required field validator )together on a single page. The required field validator validator creates problems . They interferes each others area. n shows me an err. Plz help me
1
1614
by: pawel667 | last post by:
I've got a homework to do for a next week, and cannot pass it. I had to create key which pass the validation for name "sample.domain.com". Any idea to simple reverse it ? Here is a code: ######################## Imports System
5
2628
by: da | last post by:
I've inherited an ASP.net 2.0 (VB.net) application that uses a lot of GridViews and DetailsViews. I've ran into an odd issue with validation. We've added some validators to the INSERT template to validate a field. They include a required field validator, a Regex validator checking the length of the field, and a custom validator. Each is then assigned to the same validation group. We then added a validationSummary referencing that same...
0
8989
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
9319
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
9243
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...
1
6795
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6073
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
4869
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3309
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
2780
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2213
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.