protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { List <DateTime> dates = DatePicker.getDatesBeforeToday(256); //get 1 year of dates in the past foreach (DateTime date in dates) { ddlLastProgramDate.Items.Add(date.ToShortDateString()); //add them to the drop down list ddlCreatedOnDate.Items.Add(date.ToShortDateString()); } txtUsername.Enabled = false; if (PreviousPage != null) { txtUsername.Text = PreviousPage.getUsername(); //get previous page information } else { getUserDetails(); //if previous page is not present, get logged in user details from db } } }