Quantcast
Channel: AjaxControlToolkit Work Item Rss Feed
Viewing all articles
Browse latest Browse all 4356

Closed Issue: In UpdatePanel, inside FormView, MaskEditValidator shows its message just the first time [9418]

$
0
0
Hi there!

When we use UpdatePanel and Ajax toolkit elements FormView and MaskEditValidator, the insert capability works just one time.

Here's a piece of the code:

<form id="Form1" method="post" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" EnableScriptGlobalization="True" EnableScriptLocalization="True">
</asp:ScriptManager>

<asp:UpdatePanel ID="udpEmployees" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:FormView ID="FormView1" runat="server" DataKeyNames="idEmployee" DataSourceID="EmployeesDataSource"
DefaultMode="Insert">
<InsertItemTemplate>
<asp:TextBox ID="txtBirth" runat="server" Text='<%# Bind("birthDate", "{0:MM/dd/yyyy}") %>'></asp:TextBox>
<cc1:MaskedEditExtender ID="mskBirth" runat="server"
TargetControlID="txtBirth"
Mask="99/99/9999"
MessageValidatorTip="true"
OnFocusCssClass="MaskedEditFocus"
OnInvalidCssClass="MaskedEditError"
MaskType="Date"
DisplayMoney="Left"
AcceptNegative="Left"
/>
<cc1:MaskedEditValidator ID="msvBirth" runat="server"
ControlExtender="mskBirth"
ControlToValidate="txtBirth"
IsValidEmpty="False"
EmptyValueMessage="Type the birthdate"
InvalidValueMessage="Type the birth date in the format mm/dd/yyyy"
Display="Static"
/>
<asp:Button ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert" Text="Add" ToolTip="Add this record" />
</InsertItemTemplate>
</asp:FormView>
</ContentTemplate>
</asp:UpdatePanel>


Steps to reproduce the problem:

1 - Try to save the record without typing the birth date, MaskedEditValidator shows its message correctly (because IsValidEmpty="False").

2 - Type the date correctly and save the record, pressing the Add button (InsertButton)

3 - Try to save the record without typing the birth date, MaskedEditValidator DOES NOT SHOW its message.


I found a workaround for that. I put MaskedEditValidator outside the UpdatePanel. And... WOW.. the validator it's working and showing the warning messages correctly!

4 - Cut the MaskedEditValidator tag from UpdatePanel. Outside UpdatePanel, paste the MaskedEditValidator tag.

5 - Change the MaskedEditValidator tag to:

...
</asp:UpdatePanel>

<cc1:MaskedEditValidator ID="msvBirth" runat="server"
ControlExtender="FormView1$mskBirth"
ControlToValidate="FormView1$txtBirth"
IsValidEmpty="False"
EmptyValueMessage="Type the birthdate"
InvalidValueMessage="Type the birth date in the format mm/dd/yyyy"
Display="Static"
/>

6 - Run the page again and execute the steps 1, 2 and 3. Notice that the MaskEditValidator works fine.


I think there's a problem between UpdatePanel and MaskEditValidator. I cannot figure out whose the responsability to fix the problem, Microsoft with VisualStudio or you guys with the AJAX Toolkit.

Cheers

Wander
Comments: This ticket was filed for a pre-15.1 version of AJAX Control Toolkit. If this is still an issue in v15.1 or later, please create a new inquiry.

Viewing all articles
Browse latest Browse all 4356

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>