开发者

CausesValidation checks all validators... Even validationgroups?

I have 3 different validation groups on my web page, but when I click submit I want all of the groups to validate?

It seems to me like the causesValidation="true" of the button will not validate the validators that are in their own validation group. So right now I am calling a Javascript function that manually validates the groups.

E.G

function validateAll()
    {
        Page_ClientV开发者_运维问答alidate('group1');
        Page_ClientValidate('group2');
        Page_ClientValidate('group3');
    }

Now this works fine and dandy... But it seemed to me like before I had all the groups on the page the validators where much faster than how it has to validate them now.

Is there something special i have to do to my button to get all of the groups to fire when it is clicked without the help of this Javascript function?


CausesValidation="true" does not mean it should validate all Validators on the page. It simply means it should validate. If you have the ValdationGroup="group1" for your Button1 then it will validate Validator Controls that has Vg=group1 and none other. And if you have set CausesValidation="false" for the button it won't validate at all no matter what group validators fall under.

And I don't think there is any other way. You can try Page_ClientValidate() without any validation group and that will validate all validators for which ValiationGroups IS NOT set.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜