How to Drag Datepicker in

Posted by Dotnetfundakumar under Regular Expressions on 8/28/2009 | Views : 5808 | Status : [Member] | Replies : 1
How to Drag Datepicker in suppose not have Datepicker how to select calender and populate datevalue in textbox
most urgent



Posted by: Vuyiswamb on: 8/30/2009 [Member] [MVP] [Administrator] NotApplicable

Good Morning Dotnetfundakumar

Last Friday a friend asked me the Question. i have an Example. that i will attach here. But for the sake of those who want to know how its done . First thing you need to do.

Step :1 Go to the Tool Bar and drag and drop the Calender Control into your Page.

Step :2 Go to your Toolbox and get a LinkButton

Step:3 Go to your ToolBox and get a textbox.

When this is done.

Step :4 Right Click on your calender Control and and go to the properties , check for the Visible Property and set it to False. This will make sure that when the page load the Calender Control does not fill the part of the page.

Step :5 Right click on the Calender control , Look for a Sign that look like the lightning, and that is where you get events , look for selected event and double click it. What you will see its an empty method where you will insert your event handler code.

put in the Following code

TextBox1.Text = Calendar1.SelectedDate.ToShortDateString();
Calendar1.Visible = false;

TextBox1 is the name of my TextBox. You can play around the Date Functions to Give you the Date that you want. Another thing a Date will again depend on the setup of the date in your Machine.

lets Continue

now on the Click event of your link Button use this

txtDate2.Text = "";
Calendar1.Visible = true;

This will Make sure that , after you have make a Selected to your Calender Control, it will get the selected date and hide it again.

i have attached an example.

Thank you for Posting at Dotnetfunda

Vuyiswa Maseko

 Download source file

Thank you for posting at Dotnetfunda

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

Login to post response