private void LoadTaskData() { TaskListService objListService = new TaskListService(); DataTable DT = objListService.GetAllTask(this.DBConnectionString); List <ToDoListTaskClass> TaskList = new List <ToDoListTaskClass>(); for (int i = 0; i < DT.Rows.Count; i++) { DataRow dr = DT.Rows[i]; ToDoListTaskClass objTask = new ToDoListTaskClass(); objTask.Id = Convert.ToInt32(dr["Id"]); objTask.Description = dr["Description"].ToString(); objTask.TodoListId = Convert.ToInt32(dr["ToDoListId"]); objTask.Important = Convert.ToBoolean(dr["Important"]); objTask.Archived = Convert.ToBoolean(dr["Archieved"]); objTask.Owner = dr["Owner"].ToString(); if (dr["DueDate"].ToString() != "") { objTask.DueDate = Convert.ToDateTime(dr["DueDate"].ToString()); } objTask.Title = dr["Title"].ToString(); TaskList.Add(objTask); } ViewState["TaskList"] = TaskList; }