if (!IsPostBack) { for (int i = 4; i >=1; i--) { string Month = (Convert.ToDateTime("01/" + i.ToString("00") +"/"+ DateTime.Now.Date.ToString("yyyy"))).ToString("MMM"); ddlFromMonth.Items.Insert(0, new ListItem(Month,i.ToString())); } FillToMonth();
private void FillToMonth() { ddlToMonth.Items.Clear(); for (int i = Convert.ToInt32(ddlFromMonth.SelectedValue)+5; i >= Convert.ToInt32(ddlFromMonth.SelectedValue); i--) { string Month = (Convert.ToDateTime("01/" + i.ToString("00") + "/" + DateTime.Now.Date.ToString("yyyy"))).ToString("MMM"); ddlToMonth.Items.Insert(0, new ListItem(Month, i.ToString())); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)