In my ASP.Net app, I have a textbox set to be a datepicker:
<asp:TextBox ID="uxDateTimeLocalTextbox" runat="server" TextMode="DateTimeLocal"></asp:TextBox>
When the user enters the datetime, initially its a string and must be converted to DateTime format before I send it back to my SQL Server table (where that column is in datetime format):
DateTime dateTimeOriginalEmail = Convert.ToDateTime(uxDateTimeLocalTextbox.Text);
Now, I have created functionality that will do the reverse, and populate the textbox with a value stored in the SQL table. I would think that I need to take that value and convert it back to a string. So, I tried the below (no errors were thrown) but I don't see the textbox being populated with the value from my table. I am using this method on other textboxes and dropdowns and they work fine. Any suggestions on how to get this to work? (Note: MM/DD/YYYY HH:MM AM/PM)
uxDateTimeLocalTextbox.Text = ticketInfo.Rows[0]["DateTimeOriginalEmail"].ToString();
uxDateTimeLocalTextbox.Text = newDate.ToString("yyyy-MM-ddTHH:mm");