Click here to Skip to main content
16,012,352 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Guys,


I have 2 text boxes with start data and end date. The first text should display key in date by user and second text box should display the date incremented by 1 year by default once user enters the first textbox...Any help....really appreciated.....



Regards.
Posted

Whe date is selected in first cal, you can add a day and assign to another cal.
 
Share this answer
 
Comments
Member 9861478 31-May-13 4:36am    
Thank you for your quick response.. I am looking for the year increment by 1 ...

Here is the code for your reference....but it is not working...

protected void Calendar2_SelectionChanged(object sender, EventArgs e)
{
TextBox1.Text = Calendar2.SelectedDate.ToString();


DateTime currentDate;
currentDate = Convert.ToDateTime(TextBox1.Text);
currentDate.AddYears(1);
TextBox2.Text = currentDate.ToString("dd-MMM-yyyy");
}
Member 9861478 31-May-13 5:54am    
Hey giys found the solution.......



TextBox1.Text = Calendar2.SelectedDate.ToString("dd-MMM-yyyy");


DateTime currentDate;
currentDate = Convert.ToDateTime(TextBox1.Text);
TextBox2.Text = currentDate.AddYears(1).ToString("dd/MM/yyyy");
Hey guys found the solution.......



TextBox1.Text = Calendar2.SelectedDate.ToString("dd-MMM-yyyy");


DateTime currentDate;
currentDate = Convert.ToDateTime(TextBox1.Text);
TextBox2.Text = currentDate.AddYears(1).ToString("dd/MM/yyyy");
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900