I am passing a DateTime value from SQL Table to a Textbox in ASP.Net using
<asp:TextBox ID="dateTxt" runat="server" Text='<%# Eval("date").ToString()%>' class="form-control"></asp:TextBox>
The Value in SQL is 2023-02-08 16:01:49.153
But shows in the textbox as 2/8/2023 09:07:13 PM
I want it to show as the exact SQL value.
This is how I get the value from the Database
SqlCommand cmd = new SqlCommand("SELECT * FROM ThisTable where stage = 'pending'", con)
{
CommandType = CommandType.Text
};
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
GridView1.DataSource = dt;
GridView1.DataBind();