views:

26

answers:

2

I have the following textbox with validation:

<asp:TextBox ID="txtInput" runat="server" Width="80px" 
             CausesValidation="True"></asp:TextBox>

<asp:RequiredFieldValidator ID="RequiredValidator" runat="server"
                            ControlToValidate="txtInput"  
                            Display="None" 
                            ErrorMessage="Bitte füllen Sie dieses Feld aus" 
                            Enabled="false" />

<asp:RegularExpressionValidator ID="RegularExpressionValidator" runat="server" 
                                ControlToValidate="txtInput" 
                                ValidationExpression="[0-9]{1}(\d)*" 
                                Display="None" 
                                ErrorMessage="Bitte geben Sie eine Zahl ein" 
                                Enabled="false" />

<asp:ValidatorCalloutExtender ID="ValidatorCalloutExtender1" runat="server" 
                              TargetControlID="RequiredValidator"  />

<asp:ValidatorCalloutExtender ID="ValidatorCalloutExtender2" runat="server" 
                              TargetControlID="RegularExpressionValidator"  />

If I click on a button on this page (CausesValidation is set to true) then the control validates properly. But when I put the textbox and its associated validators and extenders not directly on the page, but instead into a usercontrol then the validation-popup doesn't show anymore. It still seems to validate, because the action for the button is not triggered when the input is invalid.

A: 

your validators have Enabled="false"

y34h
Thats because I enable them on runtime. Sorry that I didn't make this clear. Again, it works if I move the control and validators out of the user control into the form.
codymanix