protected void CreateToDo_OnClick(object sender, EventArgs e) { DataClasses1DataContext db = new DataClasses1DataContext(); todo CurrentToDo = new todo { dt = DateTime.Now, name = ToDoName.Text }; db.todos.InsertOnSubmit(CurrentToDo); db.SubmitChanges(); PopulateList(); }
protected void ToDoListBoxes_OnSelectedIndexChange(object sender, EventArgs e) { for (int i = 0; i < ToDoListBoxes.Items.Count; i++) { if (ToDoListBoxes.Items[i].Selected) { DataClasses1DataContext db = new DataClasses1DataContext(); todo SelectedItem = db.todos.Where(p => p.todoID == Convert.ToInt32(ToDoListBoxes.Items[i].Value)).FirstOrDefault(); db.todos.DeleteOnSubmit(SelectedItem); db.SubmitChanges(); PopulateList(); } } }
partial void Deletetodo(todo instance);
partial void Updatetodo(todo instance);
partial void Inserttodo(todo instance);