Hello,
Error message is not going after filling of correct value textbox in asp.net c#
I have to textboxes and on both i have used same property and all. After filling of 1st text box error message is going but after filling of 2nd textbox error msg is not going only after clicking of submit button error msg is going.
Below i have attached code which i have tried:
<table border="0" style="align-content: center">
<tr>
<td align="right" class="auto-style5">
<asp:Label ID="lblStartDateFrom" Text="Start Date From" runat="server" CssClass="label"></asp:Label>
</td>
<td class="auto-style1">
<asp:TextBox ID="txtStartDateFrom" runat="server" onclick="this.focus();this.select()" AutoCompleteType="None" MaxLength="10" ValidateRequestMode="Inherit" width="90px" TabIndex="450" cssclass="textbox"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="txtStartDateFrom" ValidationExpression="^(((0?[1-9]|1[012])/(0?[1-9]|1\d|2[0-8])|(0?[13456789]|1[012])/(29|30)|(0?[13578]|1[02])/31)/(19|[2-9]\d)\d{2}|0?2/29/((19|[2-9]\d)(0[48]|[2468][048]|[13579][26])|(([2468][048]|[3579][26])00)))$"
ErrorMessage="Invalid date format." Display="Dynamic" ForeColor="Red" ValidationGroup="Group1" />
<ajax:CalendarExtender ID="CalendarExtender1" TargetControlID="txtStartDateFrom" Format="MM/dd/yyyy" runat="server" >
</ajax:CalendarExtender>
<asp:MaskedEditExtender ID="MaskedEditExtender1" runat="server" ClearMaskOnLostFocus="false" PromptCharacter=" " TargetControlID="txtStartDateFrom" Mask="99/99/9999" Enabled="true" MaskType="Date"
MessageValidatorTip="true" ErrorTooltipEnabled="True" AutoComplete="False" UserDateFormat="MonthDayYear">
</asp:MaskedEditExtender>
<asp:MaskedEditValidator ID="MaskedEditValidator1" runat="server" ControlExtender="MaskedEditExtender1" ControlToValidate="txtStartDateFrom"
Display="None" ErrorMessage="Invalid date format.." ForeColor="Red" SetFocusOnError="true" IsValidEmpty="False">
</asp:MaskedEditValidator>
<%-- <ajaxToolkit:CalendarExtender ID="CalendarExtender2" runat="server" TargetControlID="txtStartDateFrom" Animated="true" CssClass="MyCalendar"></ajaxToolkit:CalendarExtender>--%>
</td>
<td align="right" class="auto-style5">
<asp:Label ID="lblEndDateFrom" Text="End Date From" runat="server" CssClass="label"></asp:Label>
</td>
<td class="auto-style1">
<asp:TextBox ID="txtEndDateFrom" runat="server" onclick="this.focus();this.select()" AutoCompleteType="None" MaxLength="10" ValidateRequestMode="Inherit" width="90px" TabIndex="450" cssclass="textbox"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ControlToValidate="txtEndDateFrom" ValidationExpression="^(((0?[1-9]|1[012])/(0?[1-9]|1\d|2[0-8])|(0?[13456789]|1[012])/(29|30)|(0?[13578]|1[02])/31)/(19|[2-9]\d)\d{2}|0?2/29/((19|[2-9]\d)(0[48]|[2468][048]|[13579][26])|(([2468][048]|[3579][26])00)))$"
ErrorMessage="Invalid date format." Display="Dynamic" ForeColor="Red" ValidationGroup="Group1" />
<ajax:CalendarExtender ID="CalendarExtender2" TargetControlID="txtEndDateFrom" Format="MM/dd/yyyy" runat="server" >
</ajax:CalendarExtender>
<asp:MaskedEditExtender ID="MaskedEditExtender2" ClearMaskOnLostFocus="false" runat="server" PromptCharacter=" " TargetControlID="txtEndDateFrom" Mask="99/99/9999" Enabled="true" MaskType="Date"
MessageValidatorTip="true" ErrorTooltipEnabled="True" AutoComplete="False" UserDateFormat="MonthDayYear">
</asp:MaskedEditExtender>
<asp:MaskedEditValidator ID="MaskedEditValidator2" runat="server" ControlExtender="MaskedEditExtender2" ControlToValidate="txtEndDateFrom"
Display="None" ErrorMessage="Invalid date format." ForeColor="Red" SetFocusOnError="true" IsValidEmpty="False">
</asp:MaskedEditValidator>
<%-- <ajaxToolkit:CalendarExtender ID="CalendarExtender3" runat="server" TargetControlID="txtEndDateFrom" Animated="true" CssClass="MyCalendar"></ajaxToolkit:CalendarExtender>--%>
</td>
</tr>
</table>
<telerik:RadButton skin="Windows7" ID="RadPrintPreview" runat="server" Text="Display" OnClick="RadPrintPreview_Click"
Width="100px" ValidationGroup="Group1" />
Plz help me out with correct solution...