How can I determine if the value in my textbox
is a correct date
?
ex:
this is the value of the date in my Textbox:01/32/2013
I know that it is a wrong value of date, but how can I determine that it is a wrong format?
I can avoid that by using try and catch
, but I don't want to use it, I will use it if I don't find a solution in my problem.
<asp:TextBox ID="txtMEditStartDt" runat="server" Text='<%# Bind("StartDt", "{0:MM/dd/yyyy}") %>'
CssClass="datePicker" SkinID="textSkin" Width="100px"></asp:TextBox>
<asp:MaskedEditExtender ID="MaskedEditStartDt" runat="server"
TargetControlID="txtMEditStartDt" Mask="99/99/9999" MaskType="Date"
CultureAMPMPlaceholder="" CultureCurrencySymbolPlaceholder=""
CultureDateFormat="" CultureDatePlaceholder="" CultureDecimalPlaceholder=""
CultureThousandsPlaceholder="" CultureTimePlaceholder="" Enabled="True"/>
<asp:CalendarExtender ID="calendarEditStartDt" runat="server" TargetControlID="txtMEditStartDt" Format="MM/dd/yyyy">
</asp:CalendarExtender>