I get a DateTime in SQL Server DataBase and want to display it in Input:
<input class="form-control" type="date" name="ExpireDate" id="expiredate" runat="server" value="31/12/2016" style="height: 30px; width: 267px">
and here is my C# codes:
Medicine med = new Medicine();
int a = GridView1.SelectedIndex;
med.ID = int.Parse(GridView1.DataKeys[a].Value.ToString());
DataProcess bal = new DataProcess(); DataTable dt = bal.getInfo(med)
expiredate.Value = Convert.ToDateTime(dt.Rows[0][5]).ToString("dd/MM/yyyy");
I put a break point just after the last line , I saw dt.Rows[0][5]
got "{2017/5/31 0:00:00}" and expiredate.Value
got "31/05/2017",but it just shows nothing without error in webpage. And this DateTime record is inserted into DataBase through exactly the same Input, I just don't know how to display it in the same Input when I pull it out from DataBase.
First time to ask, many thanks!