Abdalla Elawad

Abdalla Elawad

  • NA
  • 1k
  • 205.1k

How to add days to date automatically when select new date

Apr 21 2016 3:36 AM
How to add date automatically when select new date ??
 
I have Dropdown list contains 2 items (ATM,CIT) ,textbox1 is (date) and textbox2 is also (date)
 
if select date in textbox1 in text_change you must display date in textboxt2 automatically +30days if selected item from droplist is = ATM
for example if i selected date in textbox1 is (01/01/2016) should display date automatically in textbox2 (30/01/2016)
 
if date in textbox1= 26/01/2016 label1 display color is yellow
 
if date in textbox1= 30/01/2016 label1 display color is Red
if date in textbox1= 01/01/2016 label1 display color Green
 
if select date in textbox1 in text_change you must display date in textboxt2 automatically +35days if selected item from droplist1 is = CIT
for example if i selected date in textbox1 is (01/01/2016) should display date automatically in textbox2 (30/01/2016)
if date in textbox1= 30/01/2016 label1 display color is yellow
if date in textbox1= 35/01/2016 label1 display color is Red
if date in textbox1= 01/01/2016 label1 display color Green
 
 
protected void TextBox5_TextChanged(object sender, EventArgs e)
{

// How to add days to current date in date in other text

TextBox6.Text = TextBox5.Text;
DateTime dt = DateTime.Now.AddDays(30);
dt.AddDays(-1).ToString("dd/MM/yyyy");
TextBox6.Text = dt.ToShortDateString();
Label1.Text = ("Team Should Be Changed In:" + dt.AddDays(0).ToShortDateString());

}
}

}
  please help me
 
 
 
 
 

Answers (14)