protected void gvReminder_RowDataBound(object sender, GridViewRowEventArgs e) { vw_Reminder reminder = e.Row.DataItem as vw_Reminder; int reminderInterval = 0; if (e.Row.RowType == DataControlRowType.DataRow) { Label lblDueIn = e.Row.FindControl("lblDueIn") as Label; //TimeSpan difference = ((DateTime)reminder.start_date) - DateTime.Now; if (reminder.DueIn < 0) { // overdue, make it color red reminderInterval = Math.Abs((int)reminder.DueIn); lblDueIn.Text = Common.convertIntervalToString(reminderInterval) + " Overdue"; e.Row.CssClass = "redstar"; PnlAlarmOverDue.Visible = true; pnlAlarm.Visible = false; } else { // due now //TimeSpan interval = DateTime.Now - (DateTime)reminder.start_date; //intervalMinutes = Math.Abs((int)interval.TotalMinutes); lblDueIn.Text = Common.convertIntervalToString((int)reminder.DueIn); } } }
protected void gvReminder_RowDataBound(object sender, GridViewRowEventArgs e) { vw_Reminder reminder = e.Row.DataItem as vw_Reminder; if (e.Row.RowType == DataControlRowType.DataRow) { Label lblDueIn = e.Row.FindControl("lblDueIn") as Label; TimeSpan difference = ((DateTime)reminder.start_date) - DateTime.Now; if (difference.TotalMinutes < 0) { // overdue lblDueIn.Text = Common.calculateOverdueTime(difference); } else { lblDueIn.Text = Common.convertIntervalToString(reminder.ReminderInterval ?? 0); } } }