i have a calender control on my page which is generated using javascript. As shown below how it looks in my aspx page.
<td colspan="2"><asp:Label ID="lblPckgStartDate" runat="server" Text="Pckg Start Date"></asp:Label>
<input ID="txtPckgStartDate" runat="server" class="NormalTextBox" ReadOnly=ReadOnly type="text" /> <a onclick="showCalendarControl(txtPckgStartDate)" href="#"><img src="calendar.gif" style="width: 20px; height: 20px" border=0 /></a>
</td>
Now when i access this textbox value on server side and load it into string variable and then pass it to date time object it gives me following error.
DateTime date = new DateTime();
string dateinddmmyyyy = txtPckgStartDate.Value.Trim();
//date in mm/dd/yyyy format
date = Convert.ToDateTime(dateinddmmyyyy);
Error:
Failed to convert parameter value from a String to a DateTime.
Plz provide me some solutions to convert string to datetime ASAP.