'Why is my error message disappearing with two of the same RegularExpressionValidators in one page?
I have in a page 2 textboxes with the exact same RegularExpressionValidator.
First case
The page is loaded. I enter in Hour1 : 88:88 and Hour2 : 77:77.
The second Error Message is disappearing. (I can see it only 1 second)
Second case:
I change 88:88 to 00:00 that is a correct format. The Validation Summary is active but there is no message.
Third case:
I change 00:00 to 88:88 and 77:77 to 00:00. The Validation Summary is working.
<div>
<asp:ValidationSummary runat="server" ID="vsErrors" />
</div>
<div class="one">
<label>Hour1 </label>
<asp:TextBox runat="server" ID="TBHour1" MaxLength="5"></asp:TextBox>
<asp:RegularExpressionValidator runat="server" ID="RegularExpressionValidator1" ControlToValidate="TBHour1" ValidationExpression="(0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]" ErrorMessage="Wrong !!" Display="None" />
</div>
<div class="two">
<label>Hour2</label>
<asp:TextBox runat="server" ID="TBHour2" MaxLength="5"></asp:TextBox>
<asp:RegularExpressionValidator runat="server" ID="RegularExpressionValidator2" ControlToValidate="TBHour2" ValidationExpression="(0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]" ErrorMessage="Wrong !!" Display="None" />
</div>
<asp:Button runat="server" ID="btSave" Text="Save" OnClick="btSave_Click" />
This problem doesn't occur when the Error Message is different.
- Is the first case a bug? So how can you explain it?
- How can you display the Error Message "Wrong !" two times?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|