protected void Page_Load(object sender, EventArgs e) { this.Page.Title = "Holiday Detection Demo"; // Create a holiday collection with some default holidays, store it in the session, and bind it to // the data grid. if (!Page.IsPostBack) { HolidayCollection hc = (HolidayCollection)Session["Holidays"]; // If we haven't been here before, create a new collection if (hc == null) { hc = new HolidayCollection(); hc.AddStandardHolidays(); Session["Holidays"] = hc; } dgHolidays.DataSource = hc; dgHolidays.DataBind(); txtFromYear.Text = (DateTime.Now.Year - 1).ToString(); txtToYear.Text = (DateTime.Now.Year + 6).ToString(); txtTestDate.Text = DateTime.Today.ToString("d"); } }
protected void Page_Load(object sender, EventArgs e) { this.Page.Title = "Holiday Detection Demo"; // Create a holiday collection with some default holidays, store it in the session, and bind it to // the data grid. if(!Page.IsPostBack) { HolidayCollection hc = (HolidayCollection)Session["Holidays"]; // If we haven't been here before, create a new collection if(hc == null) { hc = new HolidayCollection(); hc.AddStandardHolidays(); Session["Holidays"] = hc; } dgHolidays.DataSource = hc; dgHolidays.DataBind(); txtFromYear.Text = (DateTime.Now.Year - 1).ToString(); txtToYear.Text = (DateTime.Now.Year + 6).ToString(); txtTestDate.Text = DateTime.Today.ToString("d"); } }