private void GenerateReminderList() { var reminderClass = new ReminderClass(); var reminderList = reminderClass.GetReminders(); lit_reminders.Text = "<ul data-filter=\"true\" data-filter-placeholder=\"Filter Reminder...\" data-inset=\"true\" data-role=\"listview\">"; lit_reminders.Text += string.Format("<li data-role\"list-divider\">Current<span class=\"ui-li-count\">{0}</span></li>", reminderList.Count(x => x.IsActive == true)); foreach (var reminder in reminderList) { lit_reminders.Text += string.Format("<li><a data-ajax=\"false\" href=\"View.aspx?id={0}\"><h2>{1}</h2><p class=\"ul-li-aside\"><strong>{2}</strong></p></a></li>", reminder.Id, reminder.Title, ((DateTime)reminder.Date).ToString("yyyy-MM-dd")); } lit_reminders.Text += "<ul>"; }
protected void Button_Click(object sender, EventArgs e) { if (!(sender is Button)) { return; } var button = sender as Button; switch (button.CommandName.ToLower()) { case "submit": if (Page.IsValid) { var reminder = new _514_Reminder { Title = txt_title.Text, Notes = txt_notes.Text, Date = GetDateTime(txt_date.Text), IsActive = true, ListId = Convert.ToInt32(ddl_categories.SelectedValue), Priority = rbl_priority.SelectedValue }; var reminderClass = new ReminderClass(); reminderClass.Insert(reminder); txt_title.Text = string.Empty; txt_date.Text = string.Empty; txt_notes.Text = string.Empty; ddl_categories.SelectedIndex = 0; rbl_priority.SelectedValue = "Low"; lbl_success.Visible = true; } break; case "reset": txt_title.Text = string.Empty; txt_date.Text = string.Empty; txt_notes.Text = string.Empty; ddl_categories.SelectedIndex = 0; rbl_priority.SelectedValue = "Low"; break; } }