views:

22

answers:

1

Somewhat straightforward: will asp:Validators still perform validation when they're in invisible containers? How about if their ControlToValidate target is invisible?

For example:

<asp:Panel id="myPanel" runat="server" visible="false">
    <asp:Textbox id="myTextbox" runat="server" />
    <asp:RequiredFieldValidator id="myRfv" runat="server" 
        controltovalidate="myTextbox" />
</asp:Panel>

Above is a Validator in an invisible Panel. Would myRfv still perform validation? How about if myTextbox is invisible instead?

I'm asking this because I have very specialized Validators in my ASPX, wherein I also have Panels which are hidden/shown dynamically. While I'm all for disabling the validators themselves, I'm just curious whether they'll automatically disable anyway.

Thanks guys! :D

+1  A: 

If the panel is invisible nothing would be rendered, so there would be no validator.

In the other case where the control to validate is invisible it try to validate the textbox and return false(not valid) as default for not finding it

alejandrobog