views:

39

answers:

3

There are 3 validation groups on the page

Group1 Group2 Group3

After calidating the groups

Page.Validate("Group1");
Page.Validate("Group2");
Page.Validate("Group3");

Page.IsValid is false

How to find out which group caused validation fail and wich passed ?

+2  A: 

Check Page.IsValid after each call.

Daniel Dyson
`+1` That's the kind of answer everyone knows, but no-one thinks of.
sshow
No. If Group1 fails Page.IsValid is always false after checking Group2 and Group3 even if they are valid.I need to know exactly valid/or not for each group.
RubyWedge
Page.IsValid validates all validators in active validation group so you have 2 options. Either set all validators IsValid property to true, or create empty group and validate it before validating your next group
Sergej Andrejev
+1  A: 

Why not checking right after calling validate?

Sergej Andrejev
I need to know valid or not for each group but Page.IsValid set to fals after the first validation fail.
RubyWedge
+1  A: 
Page.Validate("Group1");
if (!Page.IsValid)
    return "Group 1 did not validate";

Page.Validate("Group2");
if (!Page.IsValid)
    return "Group 2 did not validate";

Page.Validate("Group3");
if (!Page.IsValid)
    return "Group 3 did not validate";
sshow