RequiredFieldValidator

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have 2 buttons on a page and both have causevalidation=true. There are many requiredfieldvalidators on the page as well. The functionality I need is when a user clicks on one button it only looks at the requiredfieldvalidators for a few controls. And when the user clicks on the other button it only looks at the requiredfieldvalidators for the other controls. Is this possible

Thanks
 
Here's one solution you might want to look at. It does have its drawbacks
though.
http://www.codeproject.com/aspnet/groupvalidator.asp

I believe asp.net 2.0 (whidbey) will fix this issue with validationgroups.

Jay said:
I have 2 buttons on a page and both have causevalidation=true. There are
many requiredfieldvalidators on the page as well. The functionality I need
is when a user clicks on one button it only looks at the
requiredfieldvalidators for a few controls. And when the user clicks on the
other button it only looks at the requiredfieldvalidators for the other
controls. Is this possible?
 
Hi Jay
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 (e-mail address removed) 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

Jay said:
I have 2 buttons on a page and both have causevalidation=true. There are
many requiredfieldvalidators on the page as well. The functionality I need
is when a user clicks on one button it only looks at the
requiredfieldvalidators for a few controls. And when the user clicks on the
other button it only looks at the requiredfieldvalidators for the other
controls. Is this possible?
 
Hmm... the age old question. Validation groups of control. I've seen a few
implementations out there.
One of my favourite is located here

[Blurb]
http://www.asp.net/Forums/ShowPost.aspx?tabindex=1&PostID=296304
Essentially, what I did to get around this is modified the
WebUIValidation.js file and created a derived page of the System.Web.UI.Page
class in which I overrided the Page_Load and Validate methods, as well as
added a ValidatorAssignments property.

Modifying both the client (.js) file and the server files ensures that the
validation will function as desired both on the client and server.
[/Blurb]

Regards,
Noel H

Jay said:
I have 2 buttons on a page and both have causevalidation=true. There are
many requiredfieldvalidators on the page as well. The functionality I need
is when a user clicks on one button it only looks at the
requiredfieldvalidators for a few controls. And when the user clicks on the
other button it only looks at the requiredfieldvalidators for the other
controls. Is this possible?
 
Back
Top