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 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
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());
}
}
}
{
// 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
14 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.

Abdalla ElawadPosted Apr 25, 2016, 3:01 AM
Thank you to all members who have contributed to the solutionAbdalla ElawadPosted Apr 25, 2016, 2:48 AM
theLizardPosted Apr 21, 2016, 5:00 PM
textBox2.Text = (date2 = date1).AddDays(30).ToString("dd/MM/yyyy");
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
if (comboBox1.SelectedIndex == 1)
{
date1 = DateTime.Now;
textBox1.Text = date1.ToString("dd/MM/yyyy");
}
Abdalla ElawadPosted Apr 21, 2016, 9:57 AM
Abdalla ElawadPosted Apr 21, 2016, 9:55 AM
Imtiyaz AnsariPosted Apr 21, 2016, 9:33 AM
Abdalla ElawadPosted Apr 21, 2016, 6:47 AM
Manas MohapatraPosted Apr 21, 2016, 6:42 AM
Abdalla ElawadPosted Apr 21, 2016, 6:40 AM
Manas MohapatraPosted Apr 21, 2016, 6:22 AM
Abdalla ElawadPosted Apr 21, 2016, 6:08 AM
Manas MohapatraPosted Apr 21, 2016, 5:49 AM
Abdalla ElawadPosted Apr 21, 2016, 5:39 AM
Manas MohapatraPosted Apr 21, 2016, 5:24 AM