开发者

asp:Validator in invisible elements + invisible targets

Somewhat straightforward: will asp:Validators still perform validation when they're in invisible containers? How about if t开发者_开发问答heir 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


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

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜