The problem I’m having is when a user skips over cycle time, even with the required field validator in place it allows to to still submit and crash the page. I tried setting an initial value but that didn’t work.
<div class="col-lg-4" style="text-align: left;">
<label for="txtCycle_Time">Cycle Time (format mm:ss) :</label>
<asp:TextBox ID="txtCycle_Time" MaxLength="5" CssClass="form-control" runat="server"></asp:TextBox>
<ajaxToolkit:MaskedEditExtender ID="txtCycle_Time_MaskedEditExtender" AutoComplete="true" MaskType="Time" AcceptAMPM="false" runat="server" MessageValidatorTip="true" TargetControlID="txtCycle_Time" Mask="99:99" ClearMaskOnLostFocus="false" />
<asp:RequiredFieldValidator ID="txtCycle_Time_RequiredFieldValidator" runat="server" InitialValue="00:00" Text="Please Enter Cycle Time" ControlToValidate="txtCycle_Time" ValidationGroup="Input" Font-Italic="True" ForeColor="Red" />
</div>
Dim Cycle_Time_Sec As Integer = 0
Dim My_Time As String = ""
My_Time = txtCycle_Time.Text
Dim Min As String = My_Time.Substring(0, 2)
Dim Sec As String = My_Time.Substring(3, 2)
Cycle_Time_Sec = Min * 60 + Sec
2
Answers
Wrote this to fix the issue, now form works as intended.
You could try a server side validation on postback: