I have a datepicker textbox. I want to store the date that is selected in the datepicker into a string variable, using c#. How will the code look like?
string date = datepicker.Text; //Does not work
I later in the code want to store the date into a database, like the following code:
string sql = "INSERT INTO tbl_mote (time, date, id) VALUES ('" + time + "','" + date + "','" + id + "')";
NpgsqlCommand command = new NpgsqlCommand(sql, conn);
int no = command.ExecuteNonQuery();
Datepicker:
<asp:TextBox ID="datepicker" runat="server"></asp:TextBox>
What happens is that todays date always saves into variable date and not the selected date.