Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Validators odd behavior 1

Status
Not open for further replies.

dbsquared

Programmer
Nov 7, 2002
175
US
I have found an odd behavior from Validators and maskededitvalidators.

what I startted with is views and one view in particular had validators on it to test ffor dates within a text box and empty is valid.
However as I switched views I was getting the message error on page. I started with the maskededitvalidator and then changed it to a comparevalidator and both exibited the same behavior.

SO I changed from the view to seperate panels that I enable the visible when I want and I found I am getting same error so once again I changed to the Comparevalidator and I got the same behavior.

I know it is the validators as when I disable them the pages work perfrectly except I can't validate my date box any more.

I was wondering is there some work around or if I have some property set wrong I am showing the setup elow
Code:
   <asp:textbox id="txtDateFrom" runat="server" Font-Bold="True" MaxLength="8" Columns="9"></asp:textbox> 
   <asp:ImageButton id="ImageButton5" runat="server" ImageUrl="~/Images/calendar.ico" Height="24px">
   </asp:ImageButton> 
   <cc1:MaskedEditExtender id="MaskedEditExtender2" runat="server" 
   TargetControlID="txtDateFrom" 
   Mask="99/99/9999"
   MaskType="Date" 
   MessageValidatorTip=true />
   <cc1:MaskedEditValidator id="MaskedEditValidator2" runat="server" InvalidValueMessage="Please enter a correct date" Display="Dynamic" ControlToValidate="txtDateFrom" ControlExtender="MaskedEditExtender2" Enabled="False" >Please enter a correct date</cc1:MaskedEditValidator>
   <asp:CompareValidator ID="CompareValidator1" runat="server" ControlToValidate="txtDateFrom"
   Display="Dynamic" ErrorMessage="Please Enter a correct date" Type="Date" Text="Please Enter a correct date" Operator="DataTypeCheck" />
   <cc1:CalendarExtender id="CalendarExtender2" runat="server" TargetControlID="txtDateFrom" Format="MM/dd/yyyy" PopupButtonID="ImageButton5" BehaviorID="CalendarExtender2" />

To go where no programmer has gone before.
 
It looks like your validators are extended controls. Did you create these, are these 3rd party controls?
 
You are correct the first one I used was the extender in the ajax control toolkit from asp.net. I diabled this one.

Then I used a standard Compare validator and got the same behavior.

To go where no programmer has gone before.
 
I would check the AJAX forums and see if there are any issues relating to their extened validator controls.
 
thank you that simple change has fixed the issue for all the validator types.
This is more of an annoyance than anything.

Thank you again.

To go where no programmer has gone before.
 
I have another issue now. If i have controls in the panels that need to validate what is in the current panel, when I press the button to say submit the form I am thrown the errors again when they are pressed.

This only seems to be with the validators that I am doing on extended textboxes.

I have other validaotrs on other textboxes that don't have exteneders on them and I don't see this behavior form them

To go where no programmer has gone before.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top