Example #1
0
        private void PopulateList()
        {
            List <ToDoItem> todos = ToDoItemData.GetToDoItems();

            TODOs.DataSource = todos;
            TODOs.DataBind();
        }
Example #2
0
        private void PopulateCategories()
        {
            List <string> categories = ToDoItemData.GetCategories();

            Category.DataSource = categories;
            Category.DataBind();
        }
Example #3
0
        protected void TODOs_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            int             index = int.Parse((string)e.CommandArgument);
            List <ToDoItem> todos = ToDoItemData.GetToDoItems();

            todos[index].Done = true;
            PopulateList();
        }
Example #4
0
        protected void Submit_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(Description.Text))
            {
                ErrorMessage.Visible = false;

                ToDoItemData.AddItem(Description.Text, Category.SelectedValue);
                PopulateList();
                Description.Text = string.Empty;
            }
            else
            {
                ErrorMessage.Visible = true;
            }
        }