I have a TextBox where I am taking input from as user as dd/mm/yyyy hh:mm:ss
. Now, I want to validate it with a regular expression. I'm not sure how to apply the expression. I have attached my code as well.
<tr>
<td style="width: 30%" class="EcommLabel">
Date From
</td>
<td style="width: 70%" class="EcommLabel">
<asp:TextBox ID="txtDateFrom" CssClass="EcommNormalTextBox" runat="server">
</asp:TextBox>MM/DD/YYYY<br />
<%-- <asp:RegularExpressionValidator ID="regDateFrom" 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)))$" ControlToValidate="txtDateFrom" ValidationGroup="Promotion" runat="server" ErrorMessage="Invalid Date"></asp:RegularExpressionValidator>--%>
<asp:RangeValidator runat="server" ID="rvDateFrom" Type="Date" ControlToValidate="txtDateFrom" MaximumValue="3000/12/31" MinimumValue="2000/1/1" ErrorMessage="Invalid Date" Display="Dynamic" ValidationGroup="Promotion" />
</td>
</tr>