I want to add days to the current date, for example, I want to enter days in numbers, and I select the days on which I want to add the current date, means days, weeks and month, but when I select days or weeks or a month it shows days, but cannot add them to the current date can anyone help me plz
protected void TextBoxPredictDays_TextChanged(object sender, EventArgs e) { string selectPredictDays = DropDownList1.SelectedItem.Value; String Days1; int Result; Days1 = TextBoxPredictedClosing.ToString(); if (selectPredictDays == "Days") { Result = Convert.ToInt32(TextBoxPredictDays.Text) * 1; TextBoxPredictedClosing.Text = Result.ToString(); } else if (selectPredictDays == "Weeks") { Result = Convert.ToInt32(TextBoxPredictDays.Text) * 7; TextBoxPredictedClosing.Text = Result.ToString(); } else if (selectPredictDays == "Months") { Result = Convert.ToInt32(TextBoxPredictDays.Text) * 30; TextBoxPredictedClosing.Text = Result.ToString(); } }
here is my design code
<asp:TextBox ID="TextBoxPredictDays" runat="server" ontextchanged="TextBoxPredictDays_TextChanged" Width="101px" Height="14px" ></asp:TextBox> <asp:DropDownList ID="DropDownList1" runat="server" onselectedindexchanged="DropDownList1_SelectedIndexChanged"> <asp:ListItem>Days</asp:ListItem> <asp:ListItem>Weeks</asp:ListItem> <asp:ListItem>Months</asp:ListItem> </asp:DropDownList>
source share