protected void Page_Load(Object sender, EventArgs e) { try { if (!this.IsPostBack) { //Create this.DateTextBox.Text = DateTime.Now.Date.ToShortDateString(); this.ActionList.DataSource = Models.Action.LoadAll(); this.ActionList.DataBind(); ActionLog log = ActionLog.FindLatest(this.Session.GetCurrentUser()); if (log != null) { this.ActionList.SelectedValue = log.Action.Guid.ToString(); } this.DurationTextBox.Text = 30.ToString(); //Filter this.FilterFrom.Text = DateTime.Now.Date.AddDays(-7).ToShortDateString(); this.FilterUntil.Text = DateTime.Now.Date.ToShortDateString(); } } catch (Exception ex) { this.Master.ShowError(ex); } }
protected void Page_PreRender(object sender, EventArgs e) { try { this.DateTextBox.Text = DateTime.Now.ToDeviceString(this.Request.Browser); ActionLog lastestEntry = ActionLog.FindLatest(this.Session.GetCurrentUser()); if (lastestEntry != null) { this.ActionList.SelectedValue = lastestEntry.Action.Guid.ToString(); } this.DurationTextBox.Text = 30.ToString(); } catch (Exception ex) { this.Master.ShowError(ex); } }