How can i get datetimepicker value to the textbox?

Posted by Anilkumar431 under ASP.NET on 1/3/2013 | Points: 10 | Views : 7928 | Status : [Member] | Replies : 2
hi all,
i have a requirement that i have one datetimepicker control that is used to select the date from the control .
and after that that value has to come into textbox...
please help me ....
it's very urgent....




Responses

Posted by: Ranjeet_8 on: 1/3/2013 [Member] [MVP] Gold | Points: 25

Up
0
Down
Try this

private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
{
dateTimePicker1.CustomFormat = "dd-MM-yyyy";
TextBox1.Text = dateTimePicker1.Value;
}


Please Mark As Answer if this helps you

.

Anilkumar431, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sourabh07 on: 1/17/2013 [Member] Starter | Points: 25

Up
0
Down
Hi,

Try the below code-

private void dateTimePicker1_ValueChanged(object sender, EventArgs e)

{ DateTime date = this.dateTimePicker1.Value;
this.textBox1.Text = date.ToString("yyyy-mm-dd");
}



Please mark the answer if this helps you.

Sourabh07

Anilkumar431, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response