How to set few validation groups for one control? (ASP.NET 2.0)

  • Thread starter Thread starter misiek
  • Start date Start date
M

misiek

Hi all.

I have following problem:
I have some user control called smallUserContrl, in which I have two
RangeValidator controls. I set their ValidationGroup property to
smallUserControlGroup.

Also I have another user control called bigUserControl, in which I use
smallUserControl. BigUserControl also has some validator, which has
ValidationGroup property set to bigUserControlGroup.

The problem is that I want to fire both validations at once
(smallUserControlGroup and bigUserControlGroup). Of course I could set
ValidationGroup property in both user controls to the same value, but
it is not a good solution. Imagine such situation: I have some page and
put there BigUserControl (which includes SmallUserControl) and also
another SmalUserControl. In such situation every validator control on
my page will be fired and that is not good, because maybe I would like
to fire validators only from bigUserControl.

Solution for this might be setting few ValidationGroups for one control
e.g. button, but it doesn't work.

Is there some other solution?

Thanks in advance
 
Even when Microsoft adds a new feature to address the limitations of their
past work, they don't always make it handle all the cases. Your case is a
reasonable one and not supported by validation groups in ASP.NET 2.0. That
system only matches to a single group name.

My Professional Validation And More (http://www.peterblum.com/vam/home.aspx)
is a replacement to the original validators. It handles this case. Its
validation groups permit one group, a list of groups
("groupname1|groupname2") and all groups using the token ("*").

Aside from that, you would have to develop some kind of hack.

--- Peter Blum
www.PeterBlum.com
Email: (e-mail address removed)
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx
 
Back
Top