protected void btnAdd_Click(object sender, EventArgs e) { int familyID = (int)Session["familyID"]; ToDoItems t = new ToDoItems(); t.FamilyID = familyID; t.ListItem = txtItemName.Text; t.DueDate = Convert.ToDateTime(txtDate.Text); t.IsComplete = "N"; t.ListType = "todo"; try { ListDA.addToDoItem(t); Response.Redirect("~/Views/ToDo.aspx"); lblError.Text = "List item added Successfully"; } catch { Response.Redirect("~/Views/ToDo.aspx"); lblError.Text = "There was an error adding the list item"; } }