protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { TimeOfDay.DataSource = getTimesInRange(new DateTime(2019, 1, 1, 7, 0, 0), new DateTime(2019, 1, 1, 20, 0, 0)); TimeOfDay.DataBind(); } }