L
Lerp
Hi all,
What do I have to do in order to get my value from my textbox that is
formatted like 'mm/dd/yyyy' into a datetime database field ?
Currently getting an error: Syntax error converting datetime from character
string
I have 2 validators on this form field as seen below along with a sub that
is supposed to be called on ServerValidate (which it seems it is misfiring)
'DATE VALIDATOR SUB
Sub ValidateDate(Sender As Object, e As ServerValidateEventArgs)
e.IsValid = isDate(e.Value)
End Sub
<!--- FROM FORM --->
<tr valign="top">
<td align="left" class="bodycopy">Date Of Birth:</td>
<td align="left" class="bodycopy">
<asp:TextBox id="dateofbirth" CssClass="textbox" columns="10"
MaxLength="10" runat="server" /> (mm/dd/yyyy format)
<asp:CustomValidator ControlToValidate="dateofbirth"
OnServerValidate="ValidateDate" ErrorMessage="Date is invalid! mm/dd/yyyy
format." Display="Dynamic" RunAt=server ID="Customvalidator1"/>
<asp:RequiredFieldValidator id="dobval" ControlToValidate="dateofbirth"
CssClass="bodyreq" Display="dynamic" Width="100%" ErrorMessage="Please enter
a date of birth." RUNAT="server"/>
</td>
</tr>
Cheers, Lerp
What do I have to do in order to get my value from my textbox that is
formatted like 'mm/dd/yyyy' into a datetime database field ?
Currently getting an error: Syntax error converting datetime from character
string
I have 2 validators on this form field as seen below along with a sub that
is supposed to be called on ServerValidate (which it seems it is misfiring)
'DATE VALIDATOR SUB
Sub ValidateDate(Sender As Object, e As ServerValidateEventArgs)
e.IsValid = isDate(e.Value)
End Sub
<!--- FROM FORM --->
<tr valign="top">
<td align="left" class="bodycopy">Date Of Birth:</td>
<td align="left" class="bodycopy">
<asp:TextBox id="dateofbirth" CssClass="textbox" columns="10"
MaxLength="10" runat="server" /> (mm/dd/yyyy format)
<asp:CustomValidator ControlToValidate="dateofbirth"
OnServerValidate="ValidateDate" ErrorMessage="Date is invalid! mm/dd/yyyy
format." Display="Dynamic" RunAt=server ID="Customvalidator1"/>
<asp:RequiredFieldValidator id="dobval" ControlToValidate="dateofbirth"
CssClass="bodyreq" Display="dynamic" Width="100%" ErrorMessage="Please enter
a date of birth." RUNAT="server"/>
</td>
</tr>
Cheers, Lerp