protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { drpDate.DataSource = DateInstance.getListDate(); drpDate.DataValueField = "DateValue"; drpDate.DataTextField = "Name"; drpDate.DataBind(); } }
protected void drpDate_SelectedIndexChanged(object sender, EventArgs e) { DateInstance [] data2 = DateInstance.getListDate().ToArray(); DateInstance dateInstance = null; for (int i = 0; i < data2.Length; i++) { if (i == drpDate.SelectedIndex) { dateInstance = data2[i]; break; } } if (dateInstance == null) { dateInstance = new DateInstance(1, "Hôm nay", DateTime.Now); } if (HttpContext.Current.Session["dateg"] != null) { HttpContext.Current.Session["dateg"] = dateInstance; } }