private void viewStateNew() { List <Brevet> brevetList = new List <Brevet>(); BrevetDAO brevetDao = new BrevetDAO(); brevetList = brevetDao.GetAllBrevets(); DateTime myDate; string myString; for (int i = 0; i < brevetList.Count; i++) { myDate = brevetList[i].BrevetDate; myString = myDate.ToString("yyyy-MM-dd"); listBoxClubs.Items.Add(new ListItem(brevetList[i].Distance.ToString() + ": " + myString + ", " + brevetList[i].Location, brevetList[i].BrevetId.ToString())); ddlDistance.Items.Add(brevetList[i].Distance.ToString()); ddlYear.Items.Add(myString); ddlLocation.Items.Add(brevetList[i].Location); } if (brevetList == null) { listBoxClubs.Items.Add("No Brevets Found!"); } }